sysctl.si › Parameters › vm.overcommit_memory

vm.overcommit_memory

Whether the kernel promises more memory than exists. 0 heuristic, 1 always, 2 strict.

Default
0
Typical value
1 for Redis

When to change it

Redis and other fork-based snapshotting often need mode 1. Mode 2 makes allocations fail early, so use it only if you understand the limits.

Check the current value

sysctl vm.overcommit_memory

Change it until the next reboot

sudo sysctl -w vm.overcommit_memory=1

Make it permanent

echo "vm.overcommit_memory = 1" | sudo tee /etc/sysctl.d/99-custom.conf
sudo sysctl --system

Related parameters

vm.swappiness · vm.dirty_ratio · vm.dirty_background_ratio · vm.max_map_count · 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.