[
https://issues.apache.org/jira/browse/HTTPCORE-593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16910064#comment-16910064
]
Linton Miller commented on HTTPCORE-593:
----------------------------------------
Pull request that makes the change, if desired:
https://github.com/apache/httpcomponents-core/pull/141
> LaxConnPool could be fairer in allocating connections
> -----------------------------------------------------
>
> Key: HTTPCORE-593
> URL: https://issues.apache.org/jira/browse/HTTPCORE-593
> Project: HttpComponents HttpCore
> Issue Type: Improvement
> Components: HttpCore
> Affects Versions: 5.0-beta8
> Reporter: Linton Miller
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> LaxConnPool may assign an available connection to a new lease request even
> though it has pending requests already queued. Though the class makes no
> guarantees of fairness, it doesn't require a major change to check if there
> are already queued requests before attempt to allocate a connection to the
> new lease. This still wouldn't establish any fairness guarantee, but would
> improve general fairness behaviour (presuming that is a desirable thing :)).
> Indeed, the code already partially has such a test, only creating new pool
> entries to fulfill the lease if the pending queue is empty:
> PoolEntry<T, C> entry = getAvailableEntry(state);
> if (entry == null && pending.isEmpty()) {
> entry = createPoolEntry();
> The change would be just to move the pending test to prior to the entire
> allocation process.
> This fairness does come at the price of the (small) extra expense of the
> pending queue test on every lease (as opposed to just some of them). It could
> be that it's preferable to maintain absolute maximum performance for lease
> when there are available connections.
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]