# Elasticsearch - limit to half of available cpu cores

**URL:** <https://discuss.elastic.co/t/elasticsearch-limit-to-half-of-available-cpu-cores/113917>\
**Category:** Elasticsearch\
**Created:** [January 3, 2018, 12:28pm UTC](https://discuss.elastic.co/t/elasticsearch-limit-to-half-of-available-cpu-cores/113917 "2018-01-03T12:28:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rs\_ela](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@rs\_ela](https://discuss.elastic.co/u/rs_ela)\
**Post date:** [January 3, 2018, 12:28pm UTC](https://discuss.elastic.co/t/elasticsearch-limit-to-half-of-available-cpu-cores/113917/1 "2018-01-03T12:28:04Z")

</div>

Hi. Is there an option to limit Elasticsearch to run, for example, on only half of available cpu cores on the machine? I'm running some heavy queries on my ELK instance which sometimes loads all cores at 100%. Since there are also other services running on this machine, the situation is not perfect.

Thanks for any suggestions!

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 3, 2018, 12:39pm UTC](https://discuss.elastic.co/t/elasticsearch-limit-to-half-of-available-cpu-cores/113917/2 "2018-01-03T12:39:42Z")

</div>

Running [ES in Docker](https://www.elastic.co/guide/en/elasticsearch/reference/6.1/docker.html) and leveraging [cgroups](https://docs.docker.com/engine/admin/resource_constraints/) would go into that direction, I'd say.

---

<div class="post-metadata">

**Author:** ![rs\_ela](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@rs\_ela](https://discuss.elastic.co/u/rs_ela)\
**Post date:** [January 3, 2018, 12:45pm UTC](https://discuss.elastic.co/t/elasticsearch-limit-to-half-of-available-cpu-cores/113917/3 "2018-01-03T12:45:37Z")

</div>

That's definetely a way to have it done, but currently I'm using regular Debian packages for ELK and would like to keep it that way.

---

<div class="post-metadata">

**Author:** ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)\
**Post date:** [January 3, 2018, 1:03pm UTC](https://discuss.elastic.co/t/elasticsearch-limit-to-half-of-available-cpu-cores/113917/4 "2018-01-03T13:03:10Z")

</div>

The other ways I know of are:

- using `nice` to manually lower the process priority or
- using `cpulimit` to repeatedly pause the process and keep it within a certain limit
- plus of course cgroups again

Outside of a container, I don't think this is good practice, though. `cpulimit` will send `SIGSTOP`/`SIGCONT` signals to the elasticsearch process and I'm not sure about the effects this can have . `nice` is too "soft" for what you want to achieve.

My advice if you don't want to leverage Docker for now, install ES on a dedicated host.

---

<div class="post-metadata">

**Author:** ![rs\_ela](https://avatars.discourse-cdn.com/v4/letter/r/f6c823/32.png) [@rs\_ela](https://discuss.elastic.co/u/rs_ela)\
**Post date:** [January 3, 2018, 1:57pm UTC](https://discuss.elastic.co/t/elasticsearch-limit-to-half-of-available-cpu-cores/113917/5 "2018-01-03T13:57:44Z")

</div>

> My advice if you don't want to leverage Docker for now, install ES on a dedicated host.

Right. Thank you for your help!

Does anyone know an approach that would fit my current environment?

---

<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:** [January 31, 2018, 1:57pm UTC](https://discuss.elastic.co/t/elasticsearch-limit-to-half-of-available-cpu-cores/113917/6 "2018-01-31T13:57:55Z")

</div>

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