0 Replies Latest reply: Sep 21, 2010 11:05 AM by 843798 RSS

    JMX/getHostByAddr

    843798
      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)