You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Huibing Yin <hu...@yahoo-inc.com> on 2013/12/20 00:20:38 UTC

The reverse DNS lookup in httpcomponents core

Hi,

We use httpcomponents core for sending high volume of data through SSL connection. Right now we have encountered an issue: if the first nameserver is out of rotation, the performance is vastly degraded. The initial investigation found that there is this class "org.apache.http.nio.pool.AbstractNIOConnPool" in which the "requestCompleted" method has a lock on a block of code, where the connection is created. During the connection creation, the constructor of "org.apache.http.nio.reactor.ssl.SSLIOSession" will do a reverse DNS lookup through

 final String<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/String.java#String> hostname = ((InetSocketAddress<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/net/InetSocketAddress.java#InetSocketAddress>) address).getHostName<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/net/InetSocketAddress.java#InetSocketAddress.getHostName%28%29>();

There is a cache DNS TTL setting for enable the cache for ip lookup by name. But I didn't found any setting for enabling the cache for reverse dns lookup.  So the question is: is there any way to avoid this reverse DNS lookup?


Thanks,
Huibing


Re: The reverse DNS lookup in httpcomponents core

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2013-12-19 at 23:20 +0000, Huibing Yin wrote:
> Hi,
> 
> We use httpcomponents core for sending high volume of data through SSL connection. Right now we have encountered an issue: if the first nameserver is out of rotation, the performance is vastly degraded. The initial investigation found that there is this class "org.apache.http.nio.pool.AbstractNIOConnPool" in which the "requestCompleted" method has a lock on a block of code, where the connection is created. During the connection creation, the constructor of "org.apache.http.nio.reactor.ssl.SSLIOSession" will do a reverse DNS lookup through
> 
>  final String<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/lang/String.java#String> hostname = ((InetSocketAddress<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/net/InetSocketAddress.java#InetSocketAddress>) address).getHostName<http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/net/InetSocketAddress.java#InetSocketAddress.getHostName%28%29>();
> 
> There is a cache DNS TTL setting for enable the cache for ip lookup by name. But I didn't found any setting for enabling the cache for reverse dns lookup.  So the question is: is there any way to avoid this reverse DNS lookup?
> 

Hi Huibing

This is a known problem. 

https://issues.apache.org/jira/browse/HTTPCORE-357

Unfortunately it was discovered only after the 4.3 release. The proper
resolution requires some API changes and therefore can only be done in
the 4.4 branch. I am still trying to figure out a way to resolve the
problem on the client side in the 4.3 branch without changing the
existing APIs.

Oleg

PS: please subscribe to the list prior to posting



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org