JMX/getHostByAddr

S

Skijor

I ran into an issue where I have a Java JMX service running on a Linux
host that is taking 23 seconds to establish a TCP connection with a
client. I took a thread dump (see below) and discovered that the time
is spent by java doing a reverse DNS look-up on the inbound connection
attempt. We have disabled the NSCD (Name Service Cache Daemon) on our
host so the DNS delay is understandable.

Question: Why does java even care about resolving the hostname? JMX
is built on top of TCP. TCP does not require DNS to establish
connectivity so why does Java insist on obtaining a hostname for the
client's IP on an inbound connection?

at java.net.Inet4AddressImpl.getHostByAddr(Native Method) ????

"Thread-5" prio=10 tid=0x00002aaacc084800 nid=0x74b5 runnable
[0x0000000042ed7000]
java.lang.Thread.State: RUNNABLE
at java.net.Inet4AddressImpl.getHostByAddr(Native Method)
at java.net.InetAddress$1.getHostByAddr(Unknown Source)
at java.net.InetAddress.getHostFromNameService(Unknown Source)
at java.net.InetAddress.getHostName(Unknown Source)
at java.net.InetAddress.getHostName(Unknown Source)
at
com.sun.jmx.remote.socket.SocketConnection.<init>(SocketConnection.java:
60)
at
com.sun.jmx.remote.socket.SocketConnectionServer.accept(SocketConnectionServer.java:
173)
at
com.sun.jmx.remote.generic.SynchroMessageConnectionServerImpl.accept(SynchroMessageConnectionServerImpl.java:
47)
at javax.management.remote.generic.GenericConnectorServer
$Receiver.run(GenericConnectorServer.java:334)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,961
Messages
2,570,130
Members
46,689
Latest member
liammiller

Latest Threads

Top