sysctl.si › Parameters › vm.max_map_count
vm.max_map_count
Maximum memory mappings per process.
- Default
- 65530
- Typical value
- 262144 for Elasticsearch and JVMs
When to change it
Elasticsearch, OpenSearch and some JVM or container workloads fail at startup with the default. Raising it costs very little memory.
How it works
Every process has memory mappings: loaded libraries, thread stacks, files opened with mmap and more. vm.max_map_count caps how many separate mappings one process can hold.
Software that maps many files or memory regions, such as Elasticsearch, OpenSearch, some databases and JVM applications, can hit the default limit of 65530 even when memory is free.
Signs you need to change it
- Elasticsearch or OpenSearch refuses to start and reports that vm.max_map_count is too low.
- Applications fail with out-of-memory or mmap errors while free -h shows plenty of RAM.
- A containerized service crashes on a node whose limit is lower than the image expects.
Recommended values by workload
- Elasticsearch or OpenSearch
- 262144 (the minimum they require)
- Kubernetes or Docker node
- 262144
- General server
- The default 65530 is usually fine
- Some Linux games
- Some ask for much higher values, such as 1048576
Common mistakes
- Setting it inside a container. It is a host-level setting, so change it on the node.
- Forgetting to make it permanent, so it resets at reboot.
- Raising it far beyond what the software asks for. Higher is not faster.
Check the current value
sysctl vm.max_map_count
Change it until the next reboot
sudo sysctl -w vm.max_map_count=262144
Make it permanent
echo "vm.max_map_count = 262144" | sudo tee /etc/sysctl.d/99-custom.conf sudo sysctl --system
Related parameters
vm.swappiness · vm.dirty_ratio · vm.dirty_background_ratio · vm.overcommit_memory · vm.min_free_kbytes · vm.nr_hugepages
Generate a full sysctl config for your server
Values are starting points. Test on a staging machine and measure before and after.