You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Linton Miller (JIRA)" <ji...@apache.org> on 2019/08/18 20:44:00 UTC
[jira] [Created] (HTTPCORE-593) LaxConnPool could be fairer in
allocating connections
Linton Miller created HTTPCORE-593:
--------------------------------------
Summary: 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
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: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org