hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michajlo Matijkiw (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HTTPCLIENT-1000) Configure Maximum Connection Lifetimes
Date Tue, 21 Sep 2010 20:24:33 GMT

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

Michajlo Matijkiw commented on HTTPCLIENT-1000:
-----------------------------------------------

We have started to look into this for ThreadSafeClientConnectionManager.  It would appear
implementation can be broken into two parts:
 1) Add the notion of a TTL for BasicPoolEntry, and have ConnPoolByRoute factor this in when
checking if an entry is expired
 2) Have DefaultRequestDirector release connections that have surpassed their TTL- the released
connection will be in turn be cleaned up by the connection pool

We have started the first part by adding an optional third argument to ThreadSafeClientConnectionManager
that propagates down to BasicPoolEntry, where it is factored into isExpired.  We considered
using HttpParams, but it would appear the relevant constructors were deprecated, therefor,
does adding the argument to the constructor seem correct?

The second part will likely be a little more involved.  Currently our intended approach is
to add a method to ManagedClientConnection to check the status of a connection.  We would
call this method in DefaultRequestDirector#execute to determine if we should release the internal
ManagedClientConnection, triggering it to fetch a new one.

Are there any thoughts on this approach?  There are still some corners of the code I have
not explored if there is an easier way to do this.

Thank you,
Michajlo

> Configure Maximum Connection Lifetimes
> --------------------------------------
>
>                 Key: HTTPCLIENT-1000
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1000
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpClient
>            Reporter: Michajlo Matijkiw
>
> Provide a means of configuring a maximum lifetime for HttpClient connections.  Currently,
it would appear as long as a connection is used it may persist indefinitely.
> This would be useful for situations where HttpClient needs to react DNS changes, such
as the following:
>  - HttpClient maintains connections to example.com which resolves to IP A
>  - Machine at IP A fails, and example.com now resolves to backup machine at IP B
>  - Since IP A is failing, connections are destroyed, and new connections are made to
IP B
>  - Machine at IP A recovers, but HttpClient maintains connections to IP B since the connections
are still healthy
> The desired behavior would be that connections to IP B will reach their connection lifetime,
and new connections could be created back to IP A according to the updated DNS settings.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


Mime
View raw message