Skip to content

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

Open
staabm opened this issue May 12, 2025 · 3 comments
Open

pre-connect to remote hosts #18539

staabm opened this issue May 12, 2025 · 3 comments

Comments

@staabm
Copy link
Contributor

staabm commented May 12, 2025

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

@ddevsr
Copy link

ddevsr commented May 13, 2025

This is related to cURL? CURLOPT_FORBID_REUSE and CURLOPT_FRESH_CONNECT with false? or CURLOPT_RESOLVE for skip DNS resolution? Nice idea to have pre-connect at level startup time (FPM?)

+1 for me. Can you start writting RFC?

@staabm
Copy link
Contributor Author

staabm commented May 13, 2025

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.

@TimWolla
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants