- PHP Client: other versions:
- Overview
- Quickstart
- Installation
- Configuration
- Inline Host Configuration
- Extended Host Configuration
- Authorization and Encryption
- Set retries
- Enabling the Logger
- Configure the HTTP Handler
- Setting the Connection Pool
- Setting the Connection Selector
- Setting the Serializer
- Setting a custom ConnectionFactory
- Set the Endpoint closure
- Building the client from a configuration hash
- Per-request configuration
- Future Mode
- Dealing with JSON Arrays and Objects in PHP
- Index Management Operations
- Indexing Documents
- Getting Documents
- Updating Documents
- Deleting documents
- Search Operations
- Namespaces
- Security
- Connection Pool
- Selectors
- Serializers
- PHP Version Requirement
- Breaking changes from 5.x
- Community DSLs
- Community Integrations
- Reference - Endpoints
- Elasticsearch\Client
- Elasticsearch\ClientBuilder
- Elasticsearch\Namespaces\CatNamespace
- Elasticsearch\Namespaces\ClusterNamespace
- Elasticsearch\Namespaces\IndicesNamespace
- Elasticsearch\Namespaces\IngestNamespace
- Elasticsearch\Namespaces\NodesNamespace
- Elasticsearch\Namespaces\RemoteNamespace
- Elasticsearch\Namespaces\SnapshotNamespace
- Elasticsearch\Namespaces\TasksNamespace
Future Mode
editFuture Mode
editThe client offers a mode called "future" or "async" mode. This allows batch processing of requests (sent in parallel to the cluster), which can have a dramatic impact on performance and throughput.
PHP is fundamentally single-threaded, however libcurl provides functionality called the "multi interface". This allows languages like PHP to gain concurrency by providing a batch of requests to process. The batch is executed in a parallel by the underlying multithreaded libcurl library, and the batch of responses is then returned to PHP.
In a single-threaded environment, the time to execute n
requests is the sum of those n
request’s latencies. With
the multi interface, the time to execute n
requests is the latency of the slowest request (assuming enough handles
are available to execute all requests in parallel).
Furthermore, the multi-interface allows requests to different hosts simultaneously, which means the Elasticsearch-PHP client can more effectively utilize your full cluster.