On Wed, 2007-02-21 at 17:13 -0500, [EMAIL PROTECTED] wrote:
> Hi!
>  
> Are there any plans to improve performance of the stale connection
> check?  
>  
> Unfortunately, we can not currently migrate to HttpClient because we
> can't afford 15-30 ms for stale checks in our environment where complete
> HTTP requests take 10 ms.  We do need the robustness provided by stale
> checks so disabling them is not a good option for us.
>  
> One way to implement fast stale checks is to use non-blocking reads with
> channels:
>  
>         try {
>             channel.configureBlocking( false );            
>             count = channel.read( buffer );
>             // connection closed if count == -1 (log EOF)
>         }
>         catch( Exception e ) {            
>             // connection reset (log exception)
>         }
>         finally {
>             channel.configureBlocking( true );
>         }
>  
> This code successfully detects closed and aborted/reset connections, and
> runs in < 1 ms.
>  
> Thanks.
>  
> - Andrew
>  

Andrew,

Unfortunately we cannot use NIO in HttpClient 3.x because of the Java
1.2.2 compatibility requirement. The stale connection check will always
remain slow due to the inherent limitations of the blocking I/O in Java
(in many JRE implementations the effective socket timeout granularity is
15 - 30ms). There is not much we can do about it.

Oleg




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to