Reverse DNS takes too long in JolokiaHttpHandler

classic Classic list List threaded Threaded
2 messages Options
tomas tomas
Reply | Threaded
Open this post in threaded view
|

Reverse DNS takes too long in JolokiaHttpHandler

Hi. I am using jolokia 1.1.2 but I think this applies to latest HEAD as well:
When I issue curl requests from localhost, everything works fine.
When I connect from remote machine, each response has a noticable delay of ~5 seconds. I made a thread dump and it looks like address.getHostName() in JolokiaHttpHandler is taking most of that time - seems like a request for reverse DNS is made there. Is there a way to avoid this?

  java.lang.Thread.State: RUNNABLE
at java.net.Inet6AddressImpl.getHostByAddr(Native Method)
at java.net.InetAddress$1.getHostByAddr(InetAddress.java:898)
at java.net.InetAddress.getHostFromNameService(InetAddress.java:583)
at java.net.InetAddress.getHostName(InetAddress.java:525)
at java.net.InetAddress.getHostName(InetAddress.java:497)
at java.net.InetSocketAddress$InetSocketAddressHolder.getHostName(InetSocketAddress.java:82)
at java.net.InetSocketAddress$InetSocketAddressHolder.access$600(InetSocketAddress.java:56)
at java.net.InetSocketAddress.getHostName(InetSocketAddress.java:345)
at org.jolokia.jvmagent.JolokiaHttpHandler.handle(JolokiaHttpHandler.java:119)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:80)
at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:668)
at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:640)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
roland roland
Reply | Threaded
Open this post in threaded view
|

Re: Reverse DNS takes too long in JolokiaHttpHandler

Sorry for the late answer. That's indeed an interesting observation, and yes there is a reverse lookup e.g. when verifying an access policy (one can restrict the access to certain hostname).

Could you please do me a favor and open an issue at https://github.com/rhuss/jolokia/issues ? Let's see how we can improve this.

thanks ...
... roland
... roland