Linux filesystem tune-up for less IO and more memory usage
[Updated on 29.Oct.2018]
As opposed to Windows, Linux and Unix systems allow user to tweak huge number of things. Most of these extra fine-grain-fine-tune-tiny-hidden-options are inside kernel, which is the core of any OS. Today I’ll show you how to tune Linux filesystem to use less IO requests, use a bit more memory.
In file /etc/sysctl.conf add the following lines
vm.swappiness = 0 vm.dirty_writeback_centisecs = 1000 vm.dirty_expire_centisecs = 10000 vm.dirty_background_ratio=20 vm.dirty_ratio = 60
and then reload active settings with:
sysctl -p
These settings will make Linux swap only if less than 15% of memory available (default is 60). Dirty-data writeback is also increased approx 10 times.
Do these changes on your own risk. These values increase risk of damaged filesystem on power failure during high activity. Make sure, that your storage is battery (ups) protected.
More useful links:
- http://docs.neo4j.org/chunked/stable/linux-performance-guide.html
- http://www.sysxperts.com/home/announce/vmdirtyratioandvmdirtybackgroundratio
- parameter explanation https://www.kernel.org/doc/Documentation/sysctl/vm.txt
- a bit crappy text, but still might be useful: http://www.cyberciti.biz/faq/linux-kernel-tuning-virtual-memory-subsystem/