hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Manikandan Subramanian (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HTTPCLIENT-1729) Evicting Stale connections from the connection pool
Date Mon, 07 Mar 2016 17:02:40 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1729?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15183269#comment-15183269

Manikandan Subramanian commented on HTTPCLIENT-1729:

Thanks for the response. Is there any guidance on the how to handle stale connection checks

Quoting the statement from the below developer guide https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html

"the stale connection check is not 100% reliable. The only feasible solution that does not
involve a one thread per socket model for idle connections is a dedicated monitor thread used
to evict connections that are considered expired due to a long period of inactivity. The monitor
thread can periodically call ClientConnectionManager#closeExpiredConnections()" 

If closeExpiredConnections is not the correct way then, is there is any guidance on how to
handle stale connection checks ? 

> Evicting Stale connections from the connection pool
> ---------------------------------------------------
>                 Key: HTTPCLIENT-1729
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1729
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>    Affects Versions: 4.5.2
>            Reporter: Manikandan Subramanian
>            Priority: Minor
>              Labels: newbie, performance
>             Fix For: 4.5.3
> This is not a bug. But more of a guidance needed here.
> The below documentation suggests
> https://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html
> to use a separate monitor thread that calls closeExpiredConnections() method for stale
connection handling.
> Is this still applicable for 4.5.2 version as well ? I am looking at source code PoolingHttpClientConnectionManager#closeExpiredConnections
which in turn calls the pool#closeExpired.
> The closeExpired method checks only the expiration of the connections. However there
seems to be no check on whether the connection is stale.
> Should we still handle stale connections checks when using Apache HttpClient 4.5 ? What
is the guidance here ?
> Minor possible documentation issue 
> http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/org/apache/http/impl/conn/PoolingHttpClientConnectionManager.html
> The above java doc claims that the default timeout that is used before a stale connection
check is performed is 5000 ms. However the source code is setting the value to 2000ms. Please
correct me if I am wrong. 

This message was sent by Atlassian JIRA

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

View raw message