php-multi-curl
php-multi-curl copied to clipboard
Multi-thread connection pooling
Hi guys. I'm not very familiar with PHP and how it works under the hood. And maybe I should post my question on PHP forums, but let me try ))
I'm here with a question about "connection pool" or "connection manager". I'm investigating is it possible to have something like "connection cache". I have read CURL docs and found that it stores handlers after execution which can be re-use if we're requesting same url+params.
But I don't fully understand is it able to share "connections" between different requests inside single server. If user A opens site1.com which makes request to some api.example.com and then user B opens site2.com (both sites located on my server) which makes same request to the sameapi.example.com. Will the request to site2.com be able to re-use connection from request into site1.com ?
I know it will work like a charm if user opens a page and that page should made dozens of requests. That's fine: just use single curl_init for sync and curl_multi_* for async operations. But it is unclear if it is possible to do the same between different requests into site. Or it will always do the same in all requests: open TCP connection, handshake, ssl validation, etc ?