/proc/sys/vm/min_free_kbytes: This controls the amount of memory that is kept free for use by special reserves including “atomic” allocations (those which cannot wait for reclaim).

Setting vm.min_free_kbytes too low prevents the system from reclaiming memory. This can result in system hangs and OOM-killing multiple processes.

However, setting this parameter to a value that is too high (5-10% of total system memory) will cause your system to become out-of-memory immediately. Linux is designed to use all available RAM to cache file system data. Setting a high min_free_kbytes value results in the system spending too much time reclaiming memory.

From the O/S perspective, the parameter vm.min_free_kbytes should be initially set in the order of 0.5% of total physical memory. Refer to the MemTotal line in the /proc/meminfo report as one place to find this value.

There is no one best value that works optimally in every scenario, so this value may need adjusting. Avoid attempting a setting that exceeds 5% of physical memory, which can trigger immediate out-of-memory conditions. The new value should be added as follows;

1. Open the file /etc/sysctl.conf.

2. Add/modify the following line;

vm.min_free_kbytes = [value]

[value] should be replaced by the actual computed value.

3. Save the file and run the following command to load the changes.

# sysctl -p /etc/sysctl.conf