|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #59111 Add support for parallel requests
Submitted: 2010-03-11 23:07 UTC Modified: 2017-10-24 06:56 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: stevvooe at gmail dot com Assigned:
Status: Open Package: solr (PECL)
PHP Version: 5.2.10 OS: Ubuntu 9.10
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: stevvooe at gmail dot com
New email:
PHP Version: OS:


 [2010-03-11 23:07 UTC] stevvooe at gmail dot com
I have a need to conduct parallel requests to multiple SOLR installations.
Currently, I have some crude utility functions that integrate the SolrQuery with
the pecl_http HttpRequest and HttpRequestPool to get this functionality, but I
would like to move this over to a single dependency. In addition, the response
parsing to build SolrObjects from a response doesn't seem to be exposed, so its
hard to integrate your library with other request methods.

So, there are two possible additions that could be made to solve these problems:

1. Add some sort of multi client, that allows you to add several queries to
several hosts, using curl_multi.

2. Expose the url generation and response parsing in PHP functions.

This is a very nice library, so I'd rather add some functionality, than hack
these features around it. Let me know if you are interested in adding something
like this, or if you'd rather I submit a patch.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-23 22:58 UTC]

Paralell requests would be a great idea if PHP supported multi-threading natively. I would like to see a patch if you have one.

 [2010-04-24 20:18 UTC] stevvooe at gmail dot com
Ah, the myth of parallel requests being the domain of threads ;).

When I say parallel requests, I am referring to non-blocking IO, managed in the course of a single function call, most likely via a curl multi handle. This technique allows better overall performance (context switching is expensive) and requires an order of magnitude less memory (compare apache pre-fork vs. nginx for memory and performance). 

I've moved off the project that required this functionality for a bit, but I may be back to it at some point, at which time I could provide a patch. 

If you are interested in how you might add non-blocking parallel requests, please see the code for the pecl_http HttpRequestPool object. I was going to use this as a starting point to provide a patch on your side, but you may see something there that inspires.

However, it may be easier just to expose the url creation and response parsing, so one could use the pecl_http module, which is quite good as well, in conjunction with your library. Decoupling the application layer, the "SOLR protocol", from the underlying http implementation may be a valuable exercise.

After you've taken a peak at the pecl_http library, let me know what you want to do, and I'll see if I can block some time out to get you a patch.
 [2010-04-27 23:40 UTC]
I will look into how this is implemented in the extension.

I will let you know.
 [2011-12-05 20:25 UTC] eric dot caron at gmail dot com
Another extension that could serve as a model for how to accomplish this would by the mysqli (via mysqlnd) and its use of mysqli::poll and MYSQLI_ASYNC.
 [2017-10-24 06:56 UTC]
-Status: Assigned +Status: Open -Assigned To: iekpo +Assigned To:
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Sep 29 20:03:56 2022 UTC