curl - ElasticSearch\Client in PHP uses MultiCurl -


whilst profiling product uses elasticsearch php client noticed natively uses curlmulti adapter guzzle when performing request.

this seems cause alot of overhead , comparing timings between client , own curl downloader shows es\client 10x slower. looks it's purely using multi.

how can update adapter use inline curl request?

i cant seem find section in documentation lets me change this.

sorry, isn't documented. benchmark accurate - usage of guzzle introduces significant overhead. overhead due autoloading costs of various guzzle classes. can replace guzzle connection curlmulticonnection class, lightweight replacement.

you can enable with:

$params['connectionclass'] = '\elasticsearch\connections\curlmulticonnection'; $client = new client($params); 

using syntax, write own replacement connection class. needs follow connectioninterface interface.

based on benchmarks (admittedly old @ point):

guzzle

  • no network: 7.095 ms

  • network ping: 15.856 ms

curlmulticonnection

  • no network: 4.345 ms

  • network ping: 7.122 ms

based on profiling, difference in speed entirely autoloading. once loaded, both connection classes perform network operations @ same throughput. execution speed improves dramatically both connection classes when used apc or hhvm.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -