# ElasticSearch Performance Issues

**URL:** <https://discuss.elastic.co/t/elasticsearch-performance-issues/10101>\
**Category:** Elasticsearch\
**Created:** [December 17, 2012, 10:20pm UTC](https://discuss.elastic.co/t/elasticsearch-performance-issues/10101 "2012-12-17T22:20:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jason\_Moore](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@Jason\_Moore](https://discuss.elastic.co/u/Jason_Moore)\
**Post date:** [December 17, 2012, 10:20pm UTC](https://discuss.elastic.co/t/elasticsearch-performance-issues/10101/1 "2012-12-17T22:20:37Z")

</div>

I am encountering a performance issue with Elasticsearch in Amazon EC2.  
Currently I am getting at most 500 rps using ab - Apache HTTP server  
benchmarking tool with a very simple query. Our goal is to get to atleast  
1000 rps, but it seems unlikely unless we throw more hardware at it. Any  
advice would be greatly appreciated.

Configurations:  
8 node cluster - m1.xlarge - 4 are EBS optimized  
Default memory(5gbs)  
Java version 1.7.0\_03  
OS Ubuntu 12.04.1

active shards 4  
replicas 1

number of documents: 1.5millions  
each document has about 400 attributes that are searchable, they are of  
varying data types.  
here are the analyzers that are applied to all string fields:

{  
"settings" : {  
"index" : {  
"number\_of\_shards" : 4,  
"number\_of\_replicas" : 1  
},  
"analysis" : {  
"char\_filter" : {  
"my\_mapping" : {  
"type" : "mapping",  
"mappings" : ["(=\>", ")=\>", "[=\>", "]=\>", "â  
¢=\>", "Â®=\>" ]  
}  
},  
"analyzer" :{  
"default" : {  
"type" : "custom",  
"tokenizer" : "whitespace",  
"filter" : ["lowercase", "pattern\_replace"],  
"char\_filter" : ["my\_mapping"],  
"stopwords" : "_none_"  
},  
"lowercase\_only\_alphanum" : {  
"type" : "custom",  
"tokenizer" : "keyword",  
"filter" : ["lowercase", "pattern\_replace"],  
"char\_filter" : ["my\_mapping"]  
}  
},  
"filter" : {  
"pattern\_replace": {  
"type" : "pattern\_replace",  
"pattern" : "\xA0",  
"replacement" : " "  
}  
}  
}  
}  
}'

Thanks,

JM

--

---

<div class="post-metadata">

**Author:** ![Randall\_McRee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/randall_mcree/32/47177_2.png) [@Randall\_McRee](https://discuss.elastic.co/u/Randall_McRee)\
**Post date:** [December 17, 2012, 10:47pm UTC](https://discuss.elastic.co/t/elasticsearch-performance-issues/10101/2 "2012-12-17T22:47:01Z")

</div>

Since you are primarily interested in query performance you should optimize  
your index e.g.

curl -XPOST "http://$ES\_HOST:9200/\_optimize?max\_num\_segments=1"

Have you tried this?

On Mon, Dec 17, 2012 at 2:20 PM, Jason Moore [jason.moore89@gmail.com](mailto:jason.moore89@gmail.com)wrote:

> I am encountering a performance issue with Elasticsearch in Amazon EC2.  
> Currently I am getting at most 500 rps using ab - Apache HTTP server  
> benchmarking tool with a very simple query. Our goal is to get to atleast  
> 1000 rps, but it seems unlikely unless we throw more hardware at it. Any  
> advice would be greatly appreciated.
> 
> Configurations:  
> 8 node cluster - m1.xlarge - 4 are EBS optimized  
> Default memory(5gbs)  
> Java version 1.7.0\_03  
> OS Ubuntu 12.04.1
> 
> active shards 4  
> replicas 1
> 
> number of documents: 1.5millions  
> each document has about 400 attributes that are searchable, they are of  
> varying data types.  
> here are the analyzers that are applied to all string fields:
> 
> {  
> "settings" : {  
> "index" : {  
> "number\_of\_shards" : 4,  
> "number\_of\_replicas" : 1  
> },  
> "analysis" : {  
> "char\_filter" : {  
> "my\_mapping" : {  
> "type" : "mapping",  
> "mappings" : ["(=\>", ")=\>", "[=\>", "]=\>", "â  
> ¢=\>", "Â®=\>" ]  
> }  
> },  
> "analyzer" :{  
> "default" : {  
> "type" : "custom",  
> "tokenizer" : "whitespace",  
> "filter" : ["lowercase", "pattern\_replace"],  
> "char\_filter" : ["my\_mapping"],  
> "stopwords" : "_none_"  
> },  
> "lowercase\_only\_alphanum" : {  
> "type" : "custom",  
> "tokenizer" : "keyword",  
> "filter" : ["lowercase", "pattern\_replace"],  
> "char\_filter" : ["my\_mapping"]  
> }  
> },  
> "filter" : {  
> "pattern\_replace": {  
> "type" : "pattern\_replace",  
> "pattern" : "\xA0",  
> "replacement" : " "  
> }  
> }  
> }  
> }  
> }'
> 
> Thanks,
> 
> JM
> 
> --

--

---

<div class="post-metadata">

**Author:** ![Jason\_Moore](https://avatars.discourse-cdn.com/v4/letter/j/c2a13f/32.png) [@Jason\_Moore](https://discuss.elastic.co/u/Jason_Moore)\
**Post date:** [December 17, 2012, 10:58pm UTC](https://discuss.elastic.co/t/elasticsearch-performance-issues/10101/3 "2012-12-17T22:58:30Z")

</div>

Thanks, RKM, but yes I have applied this to all nodes.

JM

On Monday, December 17, 2012 4:47:01 PM UTC-6, RKM wrote:

> Since you are primarily interested in query performance you should  
> optimize your index e.g.
> 
> curl -XPOST "http://$ES\_HOST:9200/\_optimize?max\_num\_segments=1"
> 
> Have you tried this?
> 
> On Mon, Dec 17, 2012 at 2:20 PM, Jason Moore \<[jason....@gmail.com](mailto:jason....@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > I am encountering a performance issue with Elasticsearch in Amazon EC2.  
> > Currently I am getting at most 500 rps using ab - Apache HTTP server  
> > benchmarking tool with a very simple query. Our goal is to get to atleast  
> > 1000 rps, but it seems unlikely unless we throw more hardware at it. Any  
> > advice would be greatly appreciated.
> > 
> > Configurations:  
> > 8 node cluster - m1.xlarge - 4 are EBS optimized  
> > Default memory(5gbs)  
> > Java version 1.7.0\_03  
> > OS Ubuntu 12.04.1
> > 
> > active shards 4  
> > replicas 1
> > 
> > number of documents: 1.5millions  
> > each document has about 400 attributes that are searchable, they are of  
> > varying data types.  
> > here are the analyzers that are applied to all string fields:
> > 
> > {  
> > "settings" : {  
> > "index" : {  
> > "number\_of\_shards" : 4,  
> > "number\_of\_replicas" : 1  
> > },  
> > "analysis" : {  
> > "char\_filter" : {  
> > "my\_mapping" : {  
> > "type" : "mapping",  
> > "mappings" : ["(=\>", ")=\>", "[=\>", "]=\>", "â  
> > ¢=\>", "Â®=\>" ]  
> > }  
> > },  
> > "analyzer" :{  
> > "default" : {  
> > "type" : "custom",  
> > "tokenizer" : "whitespace",  
> > "filter" : ["lowercase", "pattern\_replace"],  
> > "char\_filter" : ["my\_mapping"],  
> > "stopwords" : "_none_"  
> > },  
> > "lowercase\_only\_alphanum" : {  
> > "type" : "custom",  
> > "tokenizer" : "keyword",  
> > "filter" : ["lowercase", "pattern\_replace"],  
> > "char\_filter" : ["my\_mapping"]  
> > }  
> > },  
> > "filter" : {  
> > "pattern\_replace": {  
> > "type" : "pattern\_replace",  
> > "pattern" : "\xA0",  
> > "replacement" : " "  
> > }  
> > }  
> > }  
> > }  
> > }'
> > 
> > Thanks,
> > 
> > JM
> > 
> > --

--

---

<div class="post-metadata">

**Author:** ![Randall\_McRee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/randall_mcree/32/47177_2.png) [@Randall\_McRee](https://discuss.elastic.co/u/Randall_McRee)\
**Post date:** [December 18, 2012, 12:05am UTC](https://discuss.elastic.co/t/elasticsearch-performance-issues/10101/4 "2012-12-18T00:05:53Z")

</div>

Yes, well, as you speculate you may simply end up needing more memory. But  
first here is a list of "levers". Try them one by one and see which of them  
work for you:

1. mlockall : true
2. restrict the number of docs returned to 5 or even 1 if possible
3. mmapFS
4. up replicas from 4/1 to 4/2, even 4/3. This allows each query to be  
answered by fewer nodes and (if your nodes have spare capacity) it will  
increase throughput

Use bigdesk to understand what your current constraint (memory/cpu/disk io)  
is likely to be. Make sure that all nodes are at roughly the same cpu  
utilization, i.e. that the query workload is balanced across your cluster.

On Mon, Dec 17, 2012 at 2:58 PM, Jason Moore [jason.moore89@gmail.com](mailto:jason.moore89@gmail.com)wrote:

> Thanks, RKM, but yes I have applied this to all nodes.
> 
> JM
> 
> On Monday, December 17, 2012 4:47:01 PM UTC-6, RKM wrote:
> 
> > Since you are primarily interested in query performance you should  
> > optimize your index e.g.
> > 
> > curl -XPOST "http://$ES\_HOST:9200/\_\*\*optimize?max\_num\_segments=1"
> > 
> > Have you tried this?
> > 
> > On Mon, Dec 17, 2012 at 2:20 PM, Jason Moore [jason....@gmail.com](mailto:jason....@gmail.com) wrote:
> > 
> > > I am encountering a performance issue with Elasticsearch in Amazon EC2.  
> > > Currently I am getting at most 500 rps using ab - Apache HTTP server  
> > > benchmarking tool with a very simple query. Our goal is to get to atleast  
> > > 1000 rps, but it seems unlikely unless we throw more hardware at it. Any  
> > > advice would be greatly appreciated.
> > > 
> > > Configurations:  
> > > 8 node cluster - m1.xlarge - 4 are EBS optimized  
> > > Default memory(5gbs)  
> > > Java version 1.7.0\_03  
> > > OS Ubuntu 12.04.1
> > > 
> > > active shards 4  
> > > replicas 1
> > > 
> > > number of documents: 1.5millions  
> > > each document has about 400 attributes that are searchable, they are of  
> > > varying data types.  
> > > here are the analyzers that are applied to all string fields:
> > > 
> > > {  
> > > "settings" : {  
> > > "index" : {  
> > > "number\_of\_shards" : 4,  
> > > "number\_of\_replicas" : 1  
> > > },  
> > > "analysis" : {  
> > > "char\_filter" : {  
> > > "my\_mapping" : {  
> > > "type" : "mapping",  
> > > "mappings" : ["(=\>", ")=\>", "[=\>", "]=\>", "â  
> > > \*\* ¢=\>", "Â®=\>" ]  
> > > }  
> > > },  
> > > "analyzer" :{  
> > > "default" : {  
> > > "type" : "custom",  
> > > "tokenizer" : "whitespace",  
> > > "filter" : ["lowercase", "pattern\_replace"],  
> > > "char\_filter" : ["my\_mapping"],  
> > > "stopwords" : "_none_"  
> > > },  
> > > "lowercase\_only\_alphanum" : {  
> > > "type" : "custom",  
> > > "tokenizer" : "keyword",  
> > > "filter" : ["lowercase", "pattern\_replace"],  
> > > "char\_filter" : ["my\_mapping"]  
> > > }  
> > > },  
> > > "filter" : {  
> > > "pattern\_replace": {  
> > > "type" : "pattern\_replace",  
> > > "pattern" : "\xA0",  
> > > "replacement" : " "  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }'
> > > 
> > > Thanks,
> > > 
> > > JM
> > > 
> > > --
> > 
> > --

--

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [December 18, 2012, 8:16am UTC](https://discuss.elastic.co/t/elasticsearch-performance-issues/10101/5 "2012-12-18T08:16:59Z")

</div>

It would be nice if you can give us

- the size of your index, maybe it does not fit into memory
- the queries you are executing, and how distinct your field values are,  
since faceting, sorting and caching contribute a lot to performance
- information about what client you are using, since the throughput depends  
on how fast your client can process reults
- and if all nodes are participating in responding to the client or just a  
single node
- some monitoring facts about how much of your CPU, RAM, network bandwidth  
is used, to find out what resource is saturated

I assume you set the JVM heap to 5GB? Did you change other JVM settings?

Thanks,

Jörg

--

---

<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, 2:59am UTC](https://discuss.elastic.co/t/elasticsearch-performance-issues/10101/6 "2017-07-06T02:59:29Z")

</div>


