php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #69870 Persistent connection with Keep-Alive
Submitted: 2015-06-18 09:18 UTC Modified: -
Votes:4
Avg. Score:4.0 ± 1.7
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:3 (100.0%)
From: andrew dot lebedev at gmail dot com Assigned:
Status: Open Package: solr (PECL)
PHP Version: 5.5.26 OS: Linux
Private report: No CVE-ID: None
 [2015-06-18 09:18 UTC] andrew dot lebedev at gmail dot com
Description:
------------
Hello!

Whould it be posible to have a persistent connection that would live through many php requests and would support http Keep-Alive.

We are using php-fpm and each worker is doing about 500 php requests before it dies. Each php request make one request to Solr running on the same machine. It would help us a lot if each worker had one persistent connection to Solr with http Keep-Alive doing all Solr requests.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-30 14:10 UTC] omars@php.net
Hello Andrew,

Thank you for your request, Currently each SolrClient instance uses its own curl handle, keep alive is enforced, and it is enabled by default on HTTP/1.1 and 'Keep-Alive: 300' header.

I will create a ticket to modify the hard coded value to make it available as SolrClient configuration option, and refactor existing code.

For the each worker, you can use one client to make use of the persistent connection.
 [2016-08-10 14:52 UTC] dyeldandi at gmail dot com
Hello!

As far as I can see curl handler is destroyed after request ends. Would it be possible to keep curl handler in a current thread and reuse it on the next request so that tcp(http) connection would not be broken and established every time?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 14:01:29 2024 UTC