php.net |  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
Votes:2
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
 [2010-03-11 23:07 UTC] stevvooe at gmail dot com
Description:
------------
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.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-23 22:58 UTC] iekpo@php.net
Steve,

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

Thanks.
 [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] iekpo@php.net
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] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: iekpo +Assigned To:
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 14:01:29 2024 UTC