How can I make use of HTTP 1.1 persistent connections and pipelining from PHP?
I'm building a REST API (using JSON as a data encoding). API calls will all be HTTP POSTs, and I need to be able to deal with considerable volum开发者_C百科e (potentially 1,000 calls per second or more).
The server (which I'm responsible for) will be implemented in Java, but the client will most-likely be in PHP. Due to the high rate of requests, I'm keen on taking advantage of request pipelining in HTTP 1.1, but I'm unsure whether it is possible to do this from PHP (ie. where PHP is the HTTP client, not the server).
Can anyone provide any advice on how do to this from PHP?
You could use pecl_http's HttpRequestPool [1] class and call the undocumented
$pool->enablePipelining(true)
method.
[1] http://php.net/manual/en/function.httprequestpool-construct.php
精彩评论