Documenting for awareness. By default, the Lookup class will check the contents of /etc/hosts on every A and AAAA lookup, via a call to HostsFileParser#getAddressForHost. This method is synchronized and creates a hot path in a high-volume environment. There is also an I/O operation (in validateCache) inside the synchronized block, which contributes to the contention.
A workaround for this problem is to call Lookup#setDefaultHostsFileParser, Lookup#setHostsFileParser, or use the dnsjava.lookup.use_hosts_file configuration property.
Perhaps a future version of dnsjava could disable this feature by default?
Documenting for awareness. By default, the Lookup class will check the contents of
/etc/hostson every A and AAAA lookup, via a call toHostsFileParser#getAddressForHost. This method is synchronized and creates a hot path in a high-volume environment. There is also an I/O operation (invalidateCache) inside the synchronized block, which contributes to the contention.A workaround for this problem is to call
Lookup#setDefaultHostsFileParser,Lookup#setHostsFileParser, or use thednsjava.lookup.use_hosts_fileconfiguration property.Perhaps a future version of dnsjava could disable this feature by default?