# Elasticsearch performance (problem with requests timeout)

**URL:** <https://discuss.elastic.co/t/elasticsearch-performance-problem-with-requests-timeout/6627>\
**Category:** Elasticsearch\
**Created:** [February 7, 2012, 10:11pm UTC](https://discuss.elastic.co/t/elasticsearch-performance-problem-with-requests-timeout/6627 "2012-02-07T22:11:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![quain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/quain/32/2925_2.png) [@quain](https://discuss.elastic.co/u/quain)\
**Post date:** [February 7, 2012, 10:11pm UTC](https://discuss.elastic.co/t/elasticsearch-performance-problem-with-requests-timeout/6627/1 "2012-02-07T22:11:05Z")

</div>

I am fairly new to elasticsearch, and I have some questions related to  
performance. My use case is an autocomplete system, so I am only  
really searching one field, and so far I only have about 1000  
documents indexed.

My problem is that es becomes unresponsive (requests timed out) after  
only a few search GET requests in quick succession. I am using the  
default configuration (running locally on a dev machine), my query is  
a text query with phrase\_prefix. I was surprised that the system  
would become unresponsive with so little load.

Can you guys offer me some tips to improve performance? What am I  
doing wrong, or what kind of settings should I be looking at to  
improve performance?

---

<div class="post-metadata">

**Author:** ![quain](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/quain/32/2925_2.png) [@quain](https://discuss.elastic.co/u/quain)\
**Post date:** [February 7, 2012, 11:13pm UTC](https://discuss.elastic.co/t/elasticsearch-performance-problem-with-requests-timeout/6627/2 "2012-02-07T23:13:24Z")

</div>

I looked at the nodes stats, and in particular, the search time is  
1.9s, which is really slow. But the pattern seems to be very quick  
responses to a few queries in a short period of time, followed by one  
query which times out, etc. Why is this?

indices: {  
store: {  
size: 343.6kb  
size\_in\_bytes: 351942  
}  
...  
search: {  
query\_total: 465  
query\_time: 1.9s  
query\_time\_in\_millis: 1912  
query\_current: 0  
fetch\_total: 227  
fetch\_time: 121ms  
fetch\_time\_in\_millis: 121  
fetch\_current: 0  
}  
cache: {  
field\_evictions: 0  
field\_size: 0b  
field\_size\_in\_bytes: 0  
filter\_count: 0  
filter\_evictions: 0  
filter\_size: 0b  
filter\_size\_in\_bytes: 0  
...  
}

On Feb 7, 2:11 pm, quain [quaintena...@gmail.com](mailto:quaintena...@gmail.com) wrote:

> I am fairly new to elasticsearch, and I have some questions related to  
> performance. My use case is an autocomplete system, so I am only  
> really searching one field, and so far I only have about 1000  
> documents indexed.
> 
> My problem is that es becomes unresponsive (requests timed out) after  
> only a few search GET requests in quick succession. I am using the  
> default configuration (running locally on a dev machine), my query is  
> a text query with phrase\_prefix. I was surprised that the system  
> would become unresponsive with so little load.
> 
> Can you guys offer me some tips to improve performance? What am I  
> doing wrong, or what kind of settings should I be looking at to  
> improve performance?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 7, 2012, 11:32pm UTC](https://discuss.elastic.co/t/elasticsearch-performance-problem-with-requests-timeout/6627/3 "2012-02-07T23:32:51Z")

</div>

The quay\_time is the total time spent in the query phase. So, avg is: 1912 / 465 = 4.1 milliseconds.

Are you using persistent connections with HTTP (keep alive), or are you opening a new connection each time (and if so, are you sure you close them? The OS will throttle new connections if many are opened in a short period of time.

On Wednesday, February 8, 2012 at 1:13 AM, quain wrote:

> I looked at the nodes stats, and in particular, the search time is  
> 1.9s, which is really slow. But the pattern seems to be very quick  
> responses to a few queries in a short period of time, followed by one  
> query which times out, etc. Why is this?
> 
> indices: {  
> store: {  
> size: 343.6kb  
> size\_in\_bytes: 351942  
> }  
> ...  
> search: {  
> query\_total: 465  
> query\_time: 1.9s  
> query\_time\_in\_millis: 1912  
> query\_current: 0  
> fetch\_total: 227  
> fetch\_time: 121ms  
> fetch\_time\_in\_millis: 121  
> fetch\_current: 0  
> }  
> cache: {  
> field\_evictions: 0  
> field\_size: 0b  
> field\_size\_in\_bytes: 0  
> filter\_count: 0  
> filter\_evictions: 0  
> filter\_size: 0b  
> filter\_size\_in\_bytes: 0  
> ...  
> }
> 
> On Feb 7, 2:11 pm, quain \<[quaintena...@gmail.com](mailto:quaintena...@gmail.com) ([http://gmail.com](http://gmail.com))\> wrote:
> 
> > I am fairly new to elasticsearch, and I have some questions related to  
> > performance. My use case is an autocomplete system, so I am only  
> > really searching one field, and so far I only have about 1000  
> > documents indexed.
> > 
> > My problem is that es becomes unresponsive (requests timed out) after  
> > only a few search GET requests in quick succession. I am using the  
> > default configuration (running locally on a dev machine), my query is  
> > a text query with phrase\_prefix. I was surprised that the system  
> > would become unresponsive with so little load.
> > 
> > Can you guys offer me some tips to improve performance? What am I  
> > doing wrong, or what kind of settings should I be looking at to  
> > improve performance?

---

<div class="post-metadata">

**Author:** ![David\_Cheperdak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/david_cheperdak/32/2998_2.png) [@David\_Cheperdak](https://discuss.elastic.co/u/David_Cheperdak)\
**Post date:** [February 7, 2012, 11:52pm UTC](https://discuss.elastic.co/t/elasticsearch-performance-problem-with-requests-timeout/6627/4 "2012-02-07T23:52:35Z")

</div>

Hello,

I have a few question regarding scoring (tf-idf):

1. when I execute a DFS Q then F  
a) are the globally calculated TFs cached at each node that would result  
in a more accurate Q then F the next time?

For example,

i) If I were to execute a Q then F, the TFs are local to each node, the  
TF results then are inaccurate in the current state of the ES architecture  
ii) If I then run a Dfs Q then F, I force recalculation of TFs among all  
nodes  
ii) If I were to run a Q then F again, are the globally calculated TFs  
stored at each node for better search results?

Of course we are concerned with the number of times a term occurs in all  
documents.

1. When looking at a distributed model for ES:  
a) in the presence of a Master -\> LoadBalancer -\> {nodes}:n  
i) Are intermediate score calculations stored at the LoadBalancer or are  
they propagated up to the Master?  
ii) Are TF and other associated globally computed values for scoring  
distributed among the nodes without touching the LB or Master?  
iii) Are results or values cached at the LB or Master?  
iv) Under what architectural constraints would it be beneficial to  
include a LB?

Thank you,

David

---

<div class="post-metadata">

**Author:** ![vinhphu1711](https://avatars.discourse-cdn.com/v4/letter/v/a88e4f/32.png) [@vinhphu1711](https://discuss.elastic.co/u/vinhphu1711)\
**Post date:** [February 8, 2012, 5:23am UTC](https://discuss.elastic.co/t/elasticsearch-performance-problem-with-requests-timeout/6627/5 "2012-02-08T05:23:40Z")

</div>

Hi,  
Can you check the log at ES\_FOLDER/logs/\<your\_cluter\>.log to see what happened? I guess that it might run out of memory, since you said you were running ES with the default configuration.  
If that's the case, you need to allocate more memory for ES, using -Xmx parameter similarly as you do for other Java program.

Regards,  
LTVP  
On Feb 8, 2012, at 6:11 AM, quain wrote:

> I am fairly new to elasticsearch, and I have some questions related to  
> performance. My use case is an autocomplete system, so I am only  
> really searching one field, and so far I only have about 1000  
> documents indexed.
> 
> My problem is that es becomes unresponsive (requests timed out) after  
> only a few search GET requests in quick succession. I am using the  
> default configuration (running locally on a dev machine), my query is  
> a text query with phrase\_prefix. I was surprised that the system  
> would become unresponsive with so little load.
> 
> Can you guys offer me some tips to improve performance? What am I  
> doing wrong, or what kind of settings should I be looking at to  
> improve performance?

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 9, 2012, 7:03am UTC](https://discuss.elastic.co/t/elasticsearch-performance-problem-with-requests-timeout/6627/6 "2012-02-09T07:03:02Z")

</div>

On Wednesday, February 8, 2012 at 1:52 AM, David Cheperdak wrote:

> Hello,
> 
> I have a few question regarding scoring (tf-idf):
> 
> 1. when I execute a DFS Q then F  
> a) are the globally calculated TFs cached at each node that would result  
> in a more accurate Q then F the next time?
> 
> For example,
> 
> i) If I were to execute a Q then F, the TFs are local to each node, the  
> TF results then are inaccurate in the current state of the ES architecture  
> ii) If I then run a Dfs Q then F, I force recalculation of TFs among all  
> nodes  
> ii) If I were to run a Q then F again, are the globally calculated TFs  
> stored at each node for better search results?
> 
> Of course we are concerned with the number of times a term occurs in all  
> documents.

The relevant terms that match the query are extracted and aggregated each time, thats the DFS phase. So there is no caching since the query can change as well as the data can change.

> 1. When looking at a distributed model for ES:  
> a) in the presence of a Master -\> LoadBalancer -\> {nodes}:n  
> i) Are intermediate score calculations stored at the LoadBalancer or are  
> they propagated up to the Master?  
> ii) Are TF and other associated globally computed values for scoring  
> distributed among the nodes without touching the LB or Master?  
> iii) Are results or values cached at the LB or Master?  
> iv) Under what architectural constraints would it be beneficial to  
> include a LB?

There is no "node" caching of results, a request is sent to the shards and executed. There might be some caching on the shard level, for example, when using filters. Note though, filters cache work well with new documents and deletes.

> Thank you,
> 
> David

---

<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:** [July 6, 2017, 3:40am UTC](https://discuss.elastic.co/t/elasticsearch-performance-problem-with-requests-timeout/6627/7 "2017-07-06T03:40:02Z")

</div>


