Media Driver operations are slow on Mac just after launch¶
Info
NameResolver time tracking was introduced with Aeron 1.42.0. See Aeron Tooling
Problem¶
You are running on macOS, and are seeing step=-1
cluster timeouts or otherwise very slow MediaDriver bound operations (such as AddSubscription
), in particular in the moments after the Media Driver has been launched.
Solution¶
If you do not have localhost defined in /etc/hosts
on your Mac, add it for both IPv4 and IPv6. For example:
127.0.0.1 Your-MacBook-Pro.local
::1 Your-MacBook-Pro.local
Then save the file and flush your DNS with:
dscacheutil -flushcache
Discussion¶
Calls to java.net.InetAddress.getLocalHost()
can take extended periods on macOS when there is no entry for the local host in /etc/hosts
. Aeron makes use of this when looking up the local hostname when launching the Media Driver. This same slow local host lookup issue has impacted other open source projects built on Java, such as Spring and Tomcat as well.