# Elasticsearch configuration in a shared server/node

**URL:** <https://discuss.elastic.co/t/elasticsearch-configuration-in-a-shared-server-node/262729>\
**Category:** Elasticsearch\
**Created:** [January 30, 2021, 7:51pm UTC](https://discuss.elastic.co/t/elasticsearch-configuration-in-a-shared-server-node/262729 "2021-01-30T19:51:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehsan\_kabiri\_33](https://avatars.discourse-cdn.com/v4/letter/e/b77776/32.png) [@ehsan\_kabiri\_33](https://discuss.elastic.co/u/ehsan_kabiri_33)\
**Post date:** [January 30, 2021, 7:51pm UTC](https://discuss.elastic.co/t/elasticsearch-configuration-in-a-shared-server-node/262729/1 "2021-01-30T19:51:59Z")

</div>

I do know it's better to have separate server for each job, but I have a shared server between Elasticsearch and MySQL, with a total 8 Gig RAM.

we should avoid swapping in Elasticsearch, so I set `bootstrap.memory_lock: true` , and I need to set/uncomment `MAX_LOCKED_MEMORY=unlimited` in file `/etc/default/elasticsearch` .

Question : Do I have to set this to unlimited while we know that only 4G must be assigned to Elasticsearch? How do I set `MAX_LOCKED_MEMORY` to 4G for example and not to unlimited? cause I have 8G shared memory between Elasticsearch and MySQL, and is this true in this case to set it to 4G instead of unlimited? If not, what's the best configuration? I think it should be something like this maybe:

`MAX_LOCKED_MEMORY= 4G`

---

<div class="post-metadata">

**Author:** ![HenningAndersen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henningandersen/32/48188_2.png) [@HenningAndersen](https://discuss.elastic.co/u/HenningAndersen)\
**Post date:** [January 31, 2021, 5:32pm UTC](https://discuss.elastic.co/t/elasticsearch-configuration-in-a-shared-server-node/262729/2 "2021-01-31T17:32:45Z")

</div>

Hi @ehsan_kabiri_33 ,

the best configuration is `unlimited`, also for a shared host. It can be a bit problematic to calculate the precise amount of memory, since this easily changes with java versions etc. So the easier route is to just allow unlimited. Notice that this does not mean that Elasticsearch will memory lock unlimited, only that it is allowed to.

---

<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:** [February 28, 2021, 5:33pm UTC](https://discuss.elastic.co/t/elasticsearch-configuration-in-a-shared-server-node/262729/3 "2021-02-28T17:33:22Z")

</div>

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