# Elasticsearch-php slow connexion

**URL:** <https://discuss.elastic.co/t/elasticsearch-php-slow-connexion/70782>\
**Category:** Elasticsearch\
**Created:** [January 6, 2017, 11:35am UTC](https://discuss.elastic.co/t/elasticsearch-php-slow-connexion/70782 "2017-01-06T11:35:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fabien\_Sarlat](https://avatars.discourse-cdn.com/v4/letter/f/7ab992/32.png) [@Fabien\_Sarlat](https://discuss.elastic.co/u/Fabien_Sarlat)\
**Post date:** [January 6, 2017, 11:35am UTC](https://discuss.elastic.co/t/elasticsearch-php-slow-connexion/70782/1 "2017-01-06T11:35:05Z")

</div>

Hello !

I have some latence problems with the php client.

On local, when i perform the "$client-\>search($params)", my webpage will show around 250ms but on my server it's around 5s.

Without the line "$client-\>search($params)", my server webpage show in 215ms.  
When i use the verbose mode in the client in the production server, this is the return :

```
'total_time' => 0.059352000000000002,
'namelookup_time' => 3.8999999999999999E-5,
'connect_time' => 0.00031599999999999998,
'pretransfer_time' => 0.00036200000000000002,
'size_upload' => 574.0,
'size_download' => 309511.0,
'speed_download' => 5214836.0,
'speed_upload' => 9671.0,
'download_content_length' => 309511.0,
'upload_content_length' => 574.0,

```

The request is fast (0.05s), i guess the problem is when elasticsearch send back the data, but i dont know why.  
If i query from local to the Es server, i have no latence.  
But the latence happen when i query from the production server to the Es server.

I have one server who host the website and another one who host Es.  
My clusther had 3 nodes with one shards and one replicas per nodes.  
My CPU usage for the 3 nodes are under 2% and for the JVM memory it's under 20%.

I read this [this](https://github.com/guzzle/guzzle/issues/349), [this](https://github.com/guzzle/guzzle/issues/607) and [this](http://stackoverflow.com/questions/22616618/elasticsearch-client-in-php-uses-multicurl), still old topic but better than nothing.  
I tried to change the Guzzle Connection with the defaultHandler, multiHandler and singleHandler but no change.  
I tried tu put the TCP\_NODELAY but no change either.

I'm still investigating on the libcurl and the transfert between my servers but i don't see any issues.

Someone had latence issue with the elasticsearch-php client ? Or simply latence on simple query ?

Thanks in advance for reading 😃

---

<div class="post-metadata">

**Author:** ![Fabien\_Sarlat](https://avatars.discourse-cdn.com/v4/letter/f/7ab992/32.png) [@Fabien\_Sarlat](https://discuss.elastic.co/u/Fabien_Sarlat)\
**Post date:** [January 10, 2017, 9:05am UTC](https://discuss.elastic.co/t/elasticsearch-php-slow-connexion/70782/2 "2017-01-10T09:05:40Z")

</div>

Up.

No ideas ?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 7, 2017, 9:06am UTC](https://discuss.elastic.co/t/elasticsearch-php-slow-connexion/70782/3 "2017-02-07T09:06:03Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
