# Configure limit.conf for ElasticSearch server

**URL:** <https://discuss.elastic.co/t/configure-limit-conf-for-elasticsearch-server/336930>\
**Category:** Elasticsearch\
**Created:** [June 26, 2023, 8:55pm UTC](https://discuss.elastic.co/t/configure-limit-conf-for-elasticsearch-server/336930 "2023-06-26T20:55:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomTom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomtom/32/3676_2.png) [@TomTom](https://discuss.elastic.co/u/TomTom)\
**Post date:** [June 26, 2023, 8:55pm UTC](https://discuss.elastic.co/t/configure-limit-conf-for-elasticsearch-server/336930/1 "2023-06-26T20:55:36Z")

</div>

The Elasticsearch documentation says that I should configure nofile and nproc for better performance.  
But the documentation is a bit confusing.

First, do I set it to the "elastic" user that was created by Elasticsearch upon installation or to the "elasticsearch" user (which was not created at all)?

Second, how will the file `/etc/security/limits.conf` actually look after configuration? Will it look like the code below?

```auto
elasticsearch - nofile 65535
elasticsearch - nproc 4096

```

Source:

> **[Configuring system settings | Elasticsearch Guide \[8.8\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/setting-system-settings.html#ulimit)**

> **[Number of threads | Elasticsearch Guide \[8.8\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/max-number-of-threads.html)**

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [June 26, 2023, 9:18pm UTC](https://discuss.elastic.co/t/configure-limit-conf-for-elasticsearch-server/336930/2 "2023-06-26T21:18:48Z")

</div>

> [@TomTom](#):
>
> First, do I set it to the "elastic" user that was created by Elasticsearch upon installation or to the "elasticsearch" user (which was not created at all)?

How did you install elasticsearch? If you installed using a package manager like `deb` or `rpm` than the user `elasticsearch` will be created during installation.

You need to edit the limits for the user that will run Elasticsearch, which is normally `elasticsearch`.

Also, if you installed using `deb` or `rpm` you basically do not need to worry about `nofile` and `nproc` as the systemd process will set it automatically.

But if you need to manually configure the file this is correct:

> [@TomTom](#):
>
> ```auto
> elasticsearch - nofile 65535
> elasticsearch - nproc 4096
> 
> ```

---

<div class="post-metadata">

**Author:** ![TomTom](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tomtom/32/3676_2.png) [@TomTom](https://discuss.elastic.co/u/TomTom)\
**Post date:** [June 27, 2023, 12:36pm UTC](https://discuss.elastic.co/t/configure-limit-conf-for-elasticsearch-server/336930/3 "2023-06-27T12:36:42Z")

</div>

Thanks @leandrojmp ,  
I installed using Debian Package.

However, should I still worry about changing the `sysctl -w vm.max_map_count=262144` and `LimitMEMLOCK=infinity`?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [June 27, 2023, 12:43pm UTC](https://discuss.elastic.co/t/configure-limit-conf-for-elasticsearch-server/336930/4 "2023-06-27T12:43:19Z")

</div>

You need to add the `LimitMEMLOCK` to a systemd override file, but does not need to configure the `vm.max_map_count` when using systemd.

You need to follow the [documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/system-config.html) about Important System Configuration and do what it is need to your case.

When using packages like DEB or RPM, there is not much to change.

---

<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 25, 2023, 1:01pm UTC](https://discuss.elastic.co/t/configure-limit-conf-for-elasticsearch-server/336930/6 "2023-07-25T13:01:09Z")

</div>

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