geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sangjin Lee (JIRA)" <>
Subject [jira] Commented: (GERONIMO-3686) AsyncHttpClient does not reuse connection even if connections are persistent
Date Fri, 07 Dec 2007 18:33:43 GMT


Sangjin Lee commented on GERONIMO-3686:

Here is a proposal on how the connection reuse may work.

- Once an IoSession is opened and used successfully for a request-response cycle, at the end
of the response processing, we cache the IoSession.
- The sessions are stored keyed by the remote peer (host + port).  For the given remote peer,
sessions should be cached in a FIFO manner.  A non-blocking queue might be a good candidate.
- When sessions close for any reason (i.e. when the handler gets notified via sessionClosed()),
we remove the session from the cache.
- On sendRequest(), AsyncHttpClient should first check the session cache to see if there is
an available active session.  It should also check if the session is still connected.  If
not, it can keep peeling the queue until it finds one or it exhausts the queue.
- If it fails to find a connected cached session, then it opens a new connection.
- The keep-alive config on AsyncHttpClient should provide a different behavior.  If keepAlive
is set to false, then AsyncHttpClient should always open a new connection, ignoring the session
cache.  Furthermore, if keepAlive is set to false, it should add a Connection: close header
to make it explicit.
- The session cache may be global, and should be shared safely by multiple instances of AsyncHttpClient.

Thoughts?  Comments?

> AsyncHttpClient does not reuse connection even if connections are persistent
> ----------------------------------------------------------------------------
>                 Key: GERONIMO-3686
>                 URL:
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: AsyncHttpClient
>    Affects Versions: 1.x
>            Reporter: Sangjin Lee
> Each time AsyncHttpClient.sendRequest() is called, a new TCP connection is opened, even
though connections may be kept alive per HTTP spec.  If connections are kept open, they should
be reused for more requests.

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

View raw message