# Elasticsearch Benchmarking

**URL:** <https://discuss.elastic.co/t/elasticsearch-benchmarking/40508>\
**Category:** Elasticsearch\
**Created:** [January 29, 2016, 6:31pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508 "2016-01-29T18:31:23Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Omer\_Uludag](https://avatars.discourse-cdn.com/v4/letter/o/b9e5f3/32.png) [@Omer\_Uludag](https://discuss.elastic.co/u/Omer_Uludag)\
**Post date:** [January 29, 2016, 6:31pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/1 "2016-01-29T18:31:23Z")

</div>

Hello together,

I am fairly new in Benchmarking and also in Benchmarking Elasticsearch. I'm using Apache JMeter in order to assess Elasticsearch's performance. Currently, I am working on the indexing performance of Elasticseach. In order to make it comparable with Splunk and Solr. I am not using the bulk index, instead I am using N-times HTTP requests to Elasticsearch. My question, how I know how long Elasticsearch does take in order to index a HTTP update request? Particularly, JMeter provides a metric which is called throughput. It shows how much requests I can handle per second. So the thing is, if I am sending a request to Elasticsearch and it directly responds with ok, is then the document already created? Because I am interested in the time where Elasticsearch takes time to create the specific document when it gets the HTTP request. Because I think that response time is: time for send http request + time for index document + time for send http response. Remark: JMeter and the Elasticsearch node are running on the same server. I am currently only interested in the time for index the document.  
It would be great if you can help me.

Best regards

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [January 30, 2016, 1:23am UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/2 "2016-01-30T01:23:24Z")

</div>

> [@Omer\_Uludag](#):
>
> My question, how I know how long Elasticsearch does take in order to index a HTTP update request?

You'll get a response back with the time it took, that will contain the time it took.

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [January 30, 2016, 3:24pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/3 "2016-01-30T15:24:21Z")

</div>

> [@Omer\_Uludag](#):
>
> I am not using the bulk index, instead I am using N-times HTTP requests to Elasticsearch.

But is this going to fit your usage pattern? Because if not, it's an inaccurate benchmark as Elasticsearch can handle concurrent bulk requests at incredibly high rates of ingest.

> [@Omer\_Uludag](#):
>
> My question, how I know how long Elasticsearch does take in order to index a HTTP update request?

You can get this on a total basis from the [nodes stats API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-nodes-stats.html):

```json
        "indexing" : {
          "index_total" : 1024,
          "index_time_in_millis" : 560,
          "index_current" : 0,
          "index_failed" : 0,
          "delete_total" : 0,
          "delete_time_in_millis" : 0,
          "delete_current" : 0,
          "noop_update_total" : 0,
          "is_throttled" : false,
          "throttle_time_in_millis" : 0
        },

```

> [@Omer\_Uludag](#):
>
> Particularly, JMeter provides a metric which is called throughput. It shows how much requests I can handle per second.

I don't understand why you need JMeter for this, I'm concerned that it's just going to get in the way and impact the benchmark.

> [@Omer\_Uludag](#):
>
> So the thing is, if I am sending a request to Elasticsearch and it directly responds with ok, is then the document already created?

If you're doing synchronous requests, yes.

> [@Omer\_Uludag](#):
>
> JMeter and the Elasticsearch node are running on the same server.

Now I'm even more concerned it's just going to impact the benchmark.

---

<div class="post-metadata">

**Author:** ![Omer\_Uludag](https://avatars.discourse-cdn.com/v4/letter/o/b9e5f3/32.png) [@Omer\_Uludag](https://discuss.elastic.co/u/Omer_Uludag)\
**Post date:** [February 1, 2016, 7:11pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/4 "2016-02-01T19:11:07Z")

</div>

Hello Jason,

I followed your advice and I do the benchmark just only with Elasticsearch, its Bulk and Node Stats API. One question, how many documents I can send at most?  
I am using, e.g.,  
`curl -s -XPOST localhost:9200/_bulk?pretty=true --data-binary @data_1.json`  
However, mostly I can send about 50.000 documents. Do you know why I do not receive any respond after sending like 100.000 documents?

Best regards

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [February 1, 2016, 8:11pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/5 "2016-02-01T20:11:56Z")

</div>

> [@Omer\_Uludag](#):
>
> However, mostly I can send about 50.000 documents. Do you know why I do not receive any respond after sending like 100.000 documents?

How big are the documents?

---

<div class="post-metadata">

**Author:** ![Omer\_Uludag](https://avatars.discourse-cdn.com/v4/letter/o/b9e5f3/32.png) [@Omer\_Uludag](https://discuss.elastic.co/u/Omer_Uludag)\
**Post date:** [February 1, 2016, 8:12pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/6 "2016-02-01T20:12:54Z")

</div>

In total 117mb. But I would like to increase the number of documents to 6 Mil. Do I have to take another solution instead of the Bulk API?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 1, 2016, 8:38pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/7 "2016-02-01T20:38:57Z")

</div>

I believe the general recommendation is to keep individual bulk requests below 5MB in size, so you should use a smaller bulk size for optimum performance.

---

<div class="post-metadata">

**Author:** ![Omer\_Uludag](https://avatars.discourse-cdn.com/v4/letter/o/b9e5f3/32.png) [@Omer\_Uludag](https://discuss.elastic.co/u/Omer_Uludag)\
**Post date:** [February 1, 2016, 9:21pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/8 "2016-02-01T21:21:53Z")

</div>

So the idea would be: Number of docs divided by 5 mb is equivalent to the number of bulk requests? Do you would do than a loop with sending the particular amount of bulk requests with a batch or something like that? Because I am trying to assess Elasticsearch's indexing performance for indexing a particular amount of data. Sorry for asking this beginner questions.

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [February 1, 2016, 10:00pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/9 "2016-02-01T22:00:48Z")

</div>

> [@Omer\_Uludag](#):
>
> In total 117mb. But I would like to increase the number of documents to 6 Mil. Do I have to take another solution instead of the Bulk API?

That's way too large per bulk request. You'll need to find the optimal bulk size for your data set but the recommendation that @Christian_Dahlqvist gave is a good starting point. However, using that as a starting point, you should keep increasing the batch size until you start to see performance stagnate and then use that as your batch size.

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [February 1, 2016, 10:01pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/10 "2016-02-01T22:01:55Z")

</div>

> [@Omer\_Uludag](#):
>
> So the idea would be: Number of docs divided by 5 mb is equivalent to the number of bulk requests?

Yes.

> [@Omer\_Uludag](#):
>
> Do you would do than a loop with sending the particular amount of bulk requests with a batch or something like that?

Yes.

> [@Omer\_Uludag](#):
>
> Sorry for asking this beginner questions.

Performance benchmarks are in general quite tricky to get right, and we are very happy to help. 🙂

---

<div class="post-metadata">

**Author:** ![Omer\_Uludag](https://avatars.discourse-cdn.com/v4/letter/o/b9e5f3/32.png) [@Omer\_Uludag](https://discuss.elastic.co/u/Omer_Uludag)\
**Post date:** [February 1, 2016, 10:14pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/11 "2016-02-01T22:14:20Z")

</div>

Hello Jason and Christian,

thank you very much for your replies.  
I created a batch file like that:  
`for i in {0..20} do touch "/Users/oemeruludag/Desktop/benchfiles/data_${i}.json" done python /Users/oemer/Desktop/bench_desktop.py for i in {0..20} do cat data_${i}.json done for i in {0..20} do curl -s -XPOST localhost:9200/_bulk?pretty=true --data-binary @data_${i}.json done`

I am sending 20 times a 5mb bulk requests. This is the idea or? And you recommend to try to adjust the size of the bulk request. How do you wold assess the performance? I would use the node stats API and would divide number of docs by indexing time. And I then play with the number of the size of the bulk requests, until this rate does not improve.  
Would you recommend to do like that?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 1, 2016, 10:21pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/12 "2016-02-01T22:21:45Z")

</div>

You can also send multiple bulk requests in parallel in order to increase performance. Start will a single thread/process and slowly increase this until you see no further increase in throughput.

---

<div class="post-metadata">

**Author:** ![Omer\_Uludag](https://avatars.discourse-cdn.com/v4/letter/o/b9e5f3/32.png) [@Omer\_Uludag](https://discuss.elastic.co/u/Omer_Uludag)\
**Post date:** [February 1, 2016, 10:33pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/13 "2016-02-01T22:33:36Z")

</div>

How exactly can I send bulk requests in parallel? Is this also accomplished by the batch?

---

<div class="post-metadata">

**Author:** ![Omer\_Uludag](https://avatars.discourse-cdn.com/v4/letter/o/b9e5f3/32.png) [@Omer\_Uludag](https://discuss.elastic.co/u/Omer_Uludag)\
**Post date:** [February 1, 2016, 11:52pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/14 "2016-02-01T23:52:59Z")

</div>

For the performance enhancement, I am using also these configurations:

```
curl -XPUT localhost:9200/bench -d '
{
    "transient" : {
        "indices.store.throttle.type" : "none" 
    }
}'

curl -XPUT 'localhost:9200/bench/_settings' -d '
{
    "index" : {
        "number_of_replicas" : 0
    }
}'

curl -XPUT localhost:9200/bench/_settings -d '
{
    "index" : {
        "refresh_interval" : "-1"
    } 
}'

curl -XPOST 'http://localhost:9200/bench/_forcemerge?max_num_segments=5'

```

Additionally, I am using: `ES_HEAP_SIZE=32g`, since I have 131 gb memory.  
Do you have some recommendations on them or some other performance increasing settings?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 2, 2016, 6:52am UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/15 "2016-02-02T06:52:10Z")

</div>

You can use multiple threads, or start several scripts in parallel if they are single threaded.

---

<div class="post-metadata">

**Author:** ![Omer\_Uludag](https://avatars.discourse-cdn.com/v4/letter/o/b9e5f3/32.png) [@Omer\_Uludag](https://discuss.elastic.co/u/Omer_Uludag)\
**Post date:** [February 3, 2016, 8:38pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/16 "2016-02-03T20:38:40Z")

</div>

![](https://us1.discourse-cdn.com/elastic/original/2X/c/c32e14dade97b52b8c8b282abae70a5c08786fd8.png)

This shows the current results. I have used 11.2mb sized bulk requests. One thread and no parallel indexing. As you can see, the numbers of documents which I index per second decreases with increasing the number of documents. The above settings are still valid and in average the CPU was about 30-40%.  
Do you maybe have some plausible reasons for such a chart?

Best regards,

---

<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 5, 2017, 11:19pm UTC](https://discuss.elastic.co/t/elasticsearch-benchmarking/40508/17 "2017-07-05T23:19:05Z")

</div>


