[ 
https://issues.apache.org/jira/browse/HTTPCORE-586?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16894807#comment-16894807
 ] 

ASF subversion and git services commented on HTTPCORE-586:
----------------------------------------------------------

Commit 79e18804e99ea920b69f71c17b4c2a0f3e455c2a in httpcomponents-core's branch 
refs/heads/bug-fixes from Linton Miller
[ https://gitbox.apache.org/repos/asf?p=httpcomponents-core.git;h=79e1880 ]

HTTPCORE-586 Improve LaxConnPool max pool size management


> LaxConnPool can do a better job of maintaining pool size limits
> ---------------------------------------------------------------
>
>                 Key: HTTPCORE-586
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-586
>             Project: HttpComponents HttpCore
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 5.0-beta8
>            Reporter: Linton Miller
>            Priority: Major
>             Fix For: 5.0-beta9
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> LaxConnPool intentionally does not make strong guarantees about enforcing the 
> maximum size of the connection pools. However, it has poor behaviour when hit 
> with a block of concurrent requests all at once.
> e.g. if the pool max size is 2, and 20 lease request all arrive concurrently 
> at once, it may well create 20 connections.
> That's because the pool size is limited by the leased size, but there's a gap 
> in the code between testing the size and adding a leased entry:
> {code:java}
>         if (pending.isEmpty() && leased.size() < max) {
>             final PoolEntry<T, C> entry = new PoolEntry<>(route, timeToLive);
>             addLeased(entry);
> {code}
> Thus multiple threads can concurrently pass the leased.size() < max test and 
> thus all create a new PoolEntry.
> That can be greatly improved by not using the leased.size() to track pool 
> size, but to have a separate explicit AtomicInteger counting the number of 
> created PoolEntries.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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

Reply via email to