Chapter 4. Tuning the operating system 123
Draft Document for Review May 4, 2007 11:35 am 4285ch04.fm
Example 4-15 ionice command
# ionice -c3 -p113
Access time updates
The Linux file system keeps records of when files are created, updated, and accessed.
Default operations include updating the last-time-read attribute for files during reads and
writes to files. Because writing is an expensive operation, eliminating unnecessary I/O can
lead to overall improved performance. However under most conditions disabling file access
time updates will yield but a very small performance improvement.
Mounting file systems with the noatime option prevents inode access times from being
updated. If file and directory update times are not critical to your implementation, as in a
Web-serving environment, an administrator might choose to mount file systems with the
noatime flag in the /etc/fstab file as shown in Example4-16. The performance benefit of
disabling access time updates to be written to the file system ranges from 0 to 10% with an
average of 3% for file server workloads.
Example 4-16 Update /etc/fstab file with noatime option set on mounted file systems
/dev/sdb1 /mountlocation ext3 defaults,noatime 1 2
Select the journaling mode of the file system
Three journaling options of most file system can be set with the data option in the mount
command. However the journaling mode has the biggest effect on performance for Ext3 file
systems hence we suggest to use this tuning option mainly for Red Hat’s default file system:
򐂰data=journal
This journaling option provides the highest form of data consistency by causing both file
data and metadata to be journalled. It is also has the higher performance overhead.
򐂰data=ordered (default)
In this mode only metadata is written. However, file data is guaranteed to be written first.
This is the default setting.
򐂰data=writeback
This journaling option provides the fastest access to the data at the expense of data
consistency. The data is guaranteed to be consistent as the metadata is still being logged.
However, no special handling of actual file data is done and this may lead to old data
appearing in files after a system crash. It should be noted that the kind of metadata
journaling implemented when using the writeback mode is comparable to the defaults of
ReiserFS, JFS or XFS. The writeback journaling mode improves Ext3 performance
especially for small I/O sizes as it is clearly visible from the chart displayed under
Figure 4-13 on page 124. The benefit of using writeback journaling declines as I/O sizes
grow. Also note that the journaling mode of your file system does only impact write
performance. Therefore a workload that performs mainly reads (e.g. a web server) will not
benefit from changing the journaling mode.
Tip: It is generally a good idea to have a separate /var partition and mount it with the
noatime option.