php8.5
Home/ Manual/ reference / yar/ The Yar_Concurrent_Client class

The Yar_Concurrent_Client class

A static helper that batches remote RPC calls. Calls registered with Yar_Concurrent_Client::call are not sent immediately; they are all dispatched together, in parallel, by Yar_Concurrent_Client::loop.

Intro

A static helper that batches remote RPC calls. Calls registered with Yar_Concurrent_Client::call are not sent immediately; they are all dispatched together, in parallel, by Yar_Concurrent_Client::loop.

The class is meant for applications that need the results of several remote calls. Only independent calls — ones that do not need each other's results — can be batched this way; when one call depends on the result of another, the two have to run sequentially. Through Yar_Client the calls are sent one after another, each paying its full round-trip time; with the concurrent client they are sent at the same time, so the overall waiting time drops to the duration of the single slowest call.

Note

Only HTTP(S) services are supported for concurrent calls. They are sent concurrently through curl's multi-handle interface, which the TCP/Unix socket transport does not implement.

Class synopsis

class Yar_Concurrent_Client { }

Yar-concurrent-client

Source: reference/yar/yar-concurrent-client.xml · from the official PHP manual (php/doc-en)