# Elastic search takes up a lot of virtual memory under Linux

**URL:** <https://discuss.elastic.co/t/elastic-search-takes-up-a-lot-of-virtual-memory-under-linux/289279>\
**Category:** Elasticsearch\
**Created:** [November 16, 2021, 8:22am UTC](https://discuss.elastic.co/t/elastic-search-takes-up-a-lot-of-virtual-memory-under-linux/289279 "2021-11-16T08:22:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zekaifeng](https://avatars.discourse-cdn.com/v4/letter/z/c6cbf5/32.png) [@zekaifeng](https://discuss.elastic.co/u/zekaifeng)\
**Post date:** [November 16, 2021, 8:22am UTC](https://discuss.elastic.co/t/elastic-search-takes-up-a-lot-of-virtual-memory-under-linux/289279/1 "2021-11-16T08:22:51Z")

</div>

Our Elasticsearch version is 7.10.2. It runs on Linux system. The JVM memory allocation is about 3G, and the node memory is about 8G. It is a three node cluster system. The cluster has eight shard, each of which is about 20G. In the no-load state, the virtual memory occupies 45g. Why?

---

<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:** [November 16, 2021, 8:29am UTC](https://discuss.elastic.co/t/elastic-search-takes-up-a-lot-of-virtual-memory-under-linux/289279/2 "2021-11-16T08:29:28Z")

</div>

Elasticsearch uses some off-heap memory in addition to the heap, but also makes use of the operating system page cache to cache frequently accessed files in memory for better performance. I suspect this is what is showing up as memory usage. This is generally not a problem as the operating system will reclaim memory from the cache if needed, but make sure you have got swap disabled.

---

<div class="post-metadata">

**Author:** ![zekaifeng](https://avatars.discourse-cdn.com/v4/letter/z/c6cbf5/32.png) [@zekaifeng](https://discuss.elastic.co/u/zekaifeng)\
**Post date:** [November 16, 2021, 8:37am UTC](https://discuss.elastic.co/t/elastic-search-takes-up-a-lot-of-virtual-memory-under-linux/289279/3 "2021-11-16T08:37:05Z")

</div>

> [@Christian\_Dahlqvist](#):
>
> Elasticsearch uses some off-heap memory 8n addition to the heap, but also mKes use of the operating system page cache to cache frequently accessed files in memory for better performance. I suspect this is what is showing up as memory usage. This is generally not a problem as the operating system will reclaim memory from the cache if needed, but make sure you have got swap disabled.

I queried the virtual memory usage details of elasticsearch process and found that most of them are occupied by shared, and swap has been disabled.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/4/74cb10d5be3b0712912ccccfff0e97896301d65f.png)

---

<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:** [December 14, 2021, 8:38am UTC](https://discuss.elastic.co/t/elastic-search-takes-up-a-lot-of-virtual-memory-under-linux/289279/4 "2021-12-14T08:38:06Z")

</div>

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