-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #5855 - HttpClient may not send queued requests. #5856
Fixes #5855 - HttpClient may not send queued requests. #5856
Conversation
Changed the AbstractConnectionPool.acquire() logic to call tryCreate() even when create=false. This is necessary when e.g. a sender thread T2 with create=true steals a connection whose creation was triggered by another sender thread T1. In the old code, T2 did not trigger the creation of a connection, possibly leaving a request queued. In the new code, T2 would call tryCreate(queuedRequests), possibly triggering the creation of a connection. This change re-introduces the fact that when sending e.g. 20 requests concurrently, 20+ connections may be created. However, it is better to err on creating more than creating less and leaving requests queued. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
@gregw @lorban the check for Before this PR, when With this PR, the call to If the test for |
jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectionPool.java
Show resolved
Hide resolved
Indeed, But without it, RR would only create new connections if it cannot find an idle one, which may or may not not be the expected behavior. Personally, I think the default behavior should have been to spread the load across the smallest possible number of connections but since history has decided otherwise, this parameter should stay the way it is to default to spreading the load across the largest possible number of connections. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just giving this a -1 for now, as I think there is a way to do this atomically.
I will give it a try... and when it inevitably fails then I'll re-review
Issue #5855 - HttpClient may not send queued requests Moved field pending from Pool to AbstractConnectionPool. As a consequence, AbstractConnectionPool.tryCreate() now performs a demand/supply calculation to decide whether to create a new connection. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
Changed the AbstractConnectionPool.acquire() logic to call tryCreate() even
when create=false.
This is necessary when e.g. a sender thread T2 with create=true steals a
connection whose creation was triggered by another sender thread T1.
In the old code, T2 did not trigger the creation of a connection, possibly
leaving a request queued.
In the new code, T2 would call tryCreate(queuedRequests), possibly triggering
the creation of a connection.
This change re-introduces the fact that when sending e.g. 20 requests
concurrently, 20+ connections may be created.
However, it is better to err on creating more than creating less and leaving
requests queued.
Signed-off-by: Simone Bordet simone.bordet@gmail.com