elasticsearch - max_map_count vs Heap size elasticsearch - max_map_count vs Heap size elasticsearch elasticsearch

elasticsearch - max_map_count vs Heap size


To sum it up very shortly, the heap is used by Elasticsearch only and Lucene will use the rest of the memory to map index files directly into memory for blazing fast access.

That's the main reason why the best practice is to allocate half the memory to the ES heap to let the remaining half to Lucene. However, there's also another best practice to not allocate more than 32-ish GB of RAM to the ES heap (and sometimes it's even less than 30B).

So, if you have a machine with 128GB of RAM, you won't allocate 64GB to ES but still a maximum 32-ish GB and Lucene will happily gobble up all the remaining 96GB of memory to map its index files.

Tuning the memory settings is a savant mix of giving enough memory (but not too much) to ES and making sure Lucene can have a blast by using as much as the remaining memory as possible.