diff --git a/systemvm/debian/etc/sysctl.conf b/systemvm/debian/etc/sysctl.conf index e07a345481f..5dd1ae44bc1 100644 --- a/systemvm/debian/etc/sysctl.conf +++ b/systemvm/debian/etc/sysctl.conf @@ -66,3 +66,6 @@ vm.swappiness=1 # make the kernel more aggressive in reclaiming RAM from the disk and swap caches vm.vfs_cache_pressure = 200 + +# try to maintain 'free' memory thereby reducing the size of disk cache, hence reducing swapping. +vm.min_free_kbytes = 20480 diff --git a/systemvm/debian/opt/cloud/bin/setup/cloud-early-config b/systemvm/debian/opt/cloud/bin/setup/cloud-early-config index a73300b51af..27ec7499d58 100755 --- a/systemvm/debian/opt/cloud/bin/setup/cloud-early-config +++ b/systemvm/debian/opt/cloud/bin/setup/cloud-early-config @@ -206,10 +206,10 @@ patch() { physmem=$(free|awk '/^Mem:/{print $2}') case $physmem in [1-4095999]) - sysctl -w vm.vfs_cache_pressure=200 + sed -i "/^vm.vfs_cache_pressure/ c\vm.vfs_cache_pressure = 200" /etc/sysctl.conf ;; *) - sysctl -w vm.vfs_cache_pressure=100 + sed -i "/^vm.vfs_cache_pressure/ c\vm.vfs_cache_pressure = 100" /etc/sysctl.conf ;; esac