jira-importer opened a new issue, #1438:
URL: https://github.com/apache/httpcomponents-core/issues/1438

   **[Tom 
Fitzhenry](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=tomfitzhenry)**
 opened 
**[HTTPCORE-424](https://issues.apache.org/jira/browse/HTTPCORE-424?redirect=false)**
 and commented
   
   ### Usecase
   
   I make 500req/s to the same server, whose response times average 5ms. This 
only needs 3 connections. This 500req/s occasionally bursts to 1000req/s, but 
as I only have 3 connections in my connection pool, I then have to establish a 
bunch of connections (let's say 17), at which point the latency suffers the 
cost of a TCP/SSL handshake.
   
   The rate then drops to the baseline 500req/s, but next time the 1000req/s 
burst occurs, I'll be ready right?! I have 20 connections in my pool, waiting 
for me to need them.
   
   No, I won't be ready. By the time the burst occurs, these extra connections 
have timed out, because they've not been used, and these connections are 
subject to TCP and HTTP time outs (both beyond my control).
   
   It would be nice to have a way to keep these connections active, so they 
don't idle out, ready for when I next see a burst of 1000req/s.
   
   ### A possible implementation:
   
   A simple implementation would be to lease connections on a FIFO basis, 
rather than a LIFO basis (Apache HttpAsyncClient's current behaviour). With a 
FIFO policy, all connections would be kept active, so they would never idle out.
   
   Apache HttpAsyncClient uses a LinkedList, in LIFO mode: lines 83 and 129 of 
https://github.com/apache/httpcore/blob/4.4.x/httpcore-nio/src/main/java/org/apache/http/nio/pool/RouteSpecificPool.java#L83
   
   ### Other HTTP clients:
   
   RxJava uses a Queue (FIFO): 
https://github.com/ReactiveX/RxJava/blob/2a8d6c75205b13cd9bef2b7f7d47723e1c86454e/src/main/java/rx/internal/util/ObjectPool.java#L28
   Vert.x uses a Queue (FIFO): 
https://github.com/eclipse/vert.x/blob/dbdcb3c785e9d8ff70dcce6a2e148cd3da6d15f6/src/main/java/io/vertx/core/http/impl/Http1xPool.java#L48
   async-http-client allows user to specify LIFO or FIFO: 
https://github.com/AsyncHttpClient/async-http-client/issues/1184
   
   
   ---
   No further details from 
[HTTPCORE-424](https://issues.apache.org/jira/browse/HTTPCORE-424?redirect=false)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to