-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[HttpClient] Add support of the persistent cURL handles #62751
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
Conversation
2482166 to
8e06a61
Compare
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.
Doing this conflicts with the reset method.
It'd be strange to share the curl state between FPM processes but also reset it between requests.
The patch in this PR should remove the unset($this->share); to be consistent.
Then, we should discuss about the benefit vs risk of the shared vs insulate approach.
I don't have data about either so I'm open to more feedback.
8e06a61 to
aaed9f8
Compare
|
@nicolas-grekas nice catch. I've removed In our current project we do a lot of http requests. And there are too many of them has slow ssl handshake (up to 100ms). By introducton of this change we can reduce latency a lot. There is a good video from @beberlei about that |
|
I'm sure it can help reduce latency. I'm just wondering if it could bring some instabilities or unwanted state sharing. /cc @jwage it'd be great if you could check this one to see how this behaves with your load! |
aaed9f8 to
4736d12
Compare
Ohh I was just thinking about this exact thing this morning. So this allows us to share connections between php-fpm requests? I'm still on 8.3 and we are upgrading to 8.4 but as soon as we get to 8.5 I will test this. I was considering proxying all http-client traffic through a sidecar proxy like envoy to get persistent connections but this would be much simpler! Is it possible to make it opt in somehow so that we can introduce it safely and then if we have no issues, later we can change it to be enabled by default? |
8f1c2e2 to
14de47a
Compare
|
@nicolas-grekas @jwage I've added configuration option (disabled by default) to enable new behavior. Please check |
|
So when I enable "allow", is it used or does cURL decides when to use them? Otherwise the term "allow" is misleading |
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
b803548 to
15a886e
Compare
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
Outdated
Show resolved
Hide resolved
15a886e to
8d26c29
Compare
6d23a20 to
5aff9e8
Compare
nicolas-grekas
left a comment
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 turned use_persistent_connections into a per-request extra option.
This allows possibly configuring this flag on a per-scoped-client basis, and removes the need to change anything in FrameworkBundle (extra options is an open list).
|
@nicolas-grekas we have false-positive violations from php-cs-fixer (again). How to deal with that? |
|
I think we might want to change the formatting we use for the documentation of those options. PHP-CS-Fixer treats line comments that are on their own line as something that should be aligned with the indentation at the place where they are, which is sensible. |
done ✔️ . Now all description comments located above array keys and php-cs-fixer is happy. I've added that as a separate commit, feel free to revert it if you don't like it. |
38e0712 to
bd9f6c7
Compare
|
Thank you @Koc. |
PHP 8.5 adds support of the persistent cURL handles which can improve performance for HTTP requests.