Sunday, April 8, 2012

Reducing Disk I/O on Linux Systems and Improve Overall System Performance

With filesystem configuration parameters noatime and barriers, you can speed up your IO to about 30% or even more if you have many small files working together within your system (or perhaps, you're just lucky :D). 

'noatime' is an instruction to not to log/update last access time for every access of all forms to the filesystem. Since everything is a file in Unix/Linux systems, you can just imagine how much resource overhead it spends just doing that simple thing with no immediate critical objective. The number of execution times for it can be roughly the sum of files accessed and inodes.

'barriers' is the filesystem-level journaling that makes the kernel resilient to crash. However it adds an additional overhead for each write in the system. Some non-critical systems that require speed and performance can turn this off e.g development and staging environments, web application servers that does not need data persistence.

So How Do You Improve disk I/O using noatime and barriers?

You need to edit the mounts and target physical or virtual drives. In the example I edited the filesystem of root (/).

# vi /etc/fstab
On the 3rd column add, noatime,barrier=0. It will look something similar as below. Then save.

/dev/VolGroup00/LogVol00    /    ext3   noatime,barrier=0        1 1

You don't have to reboot for the changes to take effect, you can simply do,
# mount -o remount /

For ext3, barriers=0 is not needed as it is off by default.
For ext4, it's gonna improve system performance for both.

More info can be found below:

Warning: Excellent improvements to performance and substantially reduced disk I/O . However, for production systems do not have barriers=0 added especially those which contain critical data. You would never know when you need it. 
  • Related Links Widget for Blogspot

No comments: