-
Notifications
You must be signed in to change notification settings - Fork 7.9k
pre-connect to remote hosts #18539
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
Comments
This is related to cURL? +1 for me. Can you start writting RFC? |
I think its related to anything which can open a stream. At best it would work for all/most SAPIs. Maybe thats something which be be triggered during class-preloading. There might be a better alternative thought. |
Are you basically talking about worker mode like in FrankenPHP? That's doable on the FPM side as well - it just requires a bit of works and few other things to work right in FPM and possibly in apache2handler. |
No I don't mean worker mode. I was asking for, whether it is possible to warmup connections to certain hosts (before they are actually required at runtime), so connection establish overhead (TLS handshake, TCP handshake,..) will not hit at runtime, but before a user sits in front and waits for the results synchronously |
Well you need to somehow create the connection so it really depends what sort of API you have in mind. Worker is one option that can keep long term connection in the script before the script is actually hit. Then you have persistent ones but those still have hit on the first connection and they often suffer from not proper closing and accumulating connections on server. Maybe what you are looking for is some sort of better / managed persistence like connection pools but they usefulness depends on SAPI. There was also bootstrapping proposed for FPM but it's not working great for keepalive fcgi connections as there is still some wait time. So I guess you need to be a bit more specific about the proposed API. |
Here is a bit more info about early bootstrapping issue: #11723 (comment) . |
Currently I don't even know how to label this as you didn't actually say what SAPI you would like to see this or how this should be driven. There are just too many unknowns and not sure if it this is even something for GH issues - we should have here only specific feature requests that have concrete vision and details. Not just something generic for discussion. |
I see. thanks for all the feedback. will close for now until I have a more clear vision on how this thing can/should work |
Uh oh!
There was an error while loading. Please reload this page.
Description
browser have a html tag to pre-connect to hosts, also bun (a competitor to nodejs) added support for pre-connecting to hosts, like databases, http-hosts etc.
the benchmarks shared by the bun team (see above links) look like there is a considerable amount of time to be saved, in case the connection is used often enough/the hosts have enough distance in between.
I wonder whether PHP could also provide such kind of startup-time pre-connect things so we don't need to re-establish connections at every request.
DNS resolution or TLS connection handshakes could already be completed before the PHP script beeing run even knows it will need it later
The text was updated successfully, but these errors were encountered: