How can I make use of HTTP 1.1 persistent connecti

2020-03-04 09:24发布

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 volume (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?

标签: php http
1条回答
三岁会撩人
2楼-- · 2020-03-04 09:36

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

查看更多
登录 后发表回答