-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add connection-limiting pool #253
Conversation
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.
thanks for the clarification
990379e
to
d19c073
Compare
Why SingleStreamConnectionPool? It isn't a single stream, but the concurrency you specify in the semaphore. |
@kelunik Yes, was thinking of a mutex not a semaphore. I renamed it to |
Alias added for BC.
@nicolas-grekas Could you clarify which limit you actually intend to use? I guess you want something like 6 connections for HTTP/1 and one connection for HTTP/2? |
Yes correct. Using up to 6 connections on h2 would work too, but I don't know which algo should select opening a new connection vs a new stream. Dunno also how curl does it. |
But isn't the limit also there to limit concurrent requests, which is then basically no longer the case for HTTP/2 connections? |
Yes that's true. Yet browsers still open several connections to work around TCP throttling, which is the drawback of h2, the reason why h3 exists. |
418a7cc
to
847cabd
Compare
Pushed a commit that separates the HTTP/2 and HTTP/1.x connection limits in the pool. Default is 6 HTTP/1.x and 1 HTTP/2. Does this make sense for most use-cases? |
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.
Thanks! 6 & 1 work for me but I'm wondering: let's say there is only one single maximum for both h1 and h2. Is there a way to race for "new connection is ready" vs "existing connection becomes available" and have this logic decide which stream is used for the next request? It would work for both h1 and h2 and might be the most performant, WDYT?
Yes, that should be possible. |
httpbin.org appears to have switched to HTTP/2 on HTTPS.
I hope my last comment didn't block progress on this one :) |
@nicolas-grekas Maybe a little. 😏 I have another branch, fallback-to-existing-connection that extends this PR, what do you think? Can you give it a try? If that approach works well, I'll merge it into this PR. |
Naming is so hard… still not sure if I like this one either.
Why duplicate code when I can effectively remove the limits!
I just checked out this PR and I confirm it fixes the perf issue, which means connections are now much better reused. I tried using I think there should be only one single |
Reduced delay in tests for faster execution.
PR updated on Symfony's side, now using a single $maxHostConnections setting, all green. Merge + tag pending, then we'll be able to merge on Symfony's side \o/ |
437e733
to
e2440b4
Compare
@nicolas-grekas We're done. \o/ |
Not sure on the name, suggestions welcome.
Should we deprecate
LimitedConnectionPool
or rename it (with an alias of the old name) toSingleStreamConnectionPool
or leave it as-is?Closes #252.