4285ch04.fm Draft Document for Review May 4, 2007 11:35 am
124 Linux Performance and Tuning Guidelines
Figure 4-13 Random write performance impact of data=writeback
There are three ways to change the journaling mode on a file system:
򐂰When executing the mount command:
mount -o data=writeback /dev/sdb1 /mnt/mountpoint
/dev/sdb1 is the file system being mounted.
򐂰Including it in the options section of the /etc/fstab file:
/dev/sdb1 /testfs ext3 defaults,data=writeback 0 0
򐂰If you want to modify the default data=ordered option on the root partition, make the
change to the /etc/fstab file listed above, then execute the mkinitrd command to scan
the changes in the /etc/fstab file and create a new image. Update grub or lilo to point to
the new image.
Block sizes
The block size, the smallest amount of data that can be read or written to a drive, can have a
direct impact on a server’s performance. As a guideline, if your server is handling many small
files, then a smaller block size will be more efficient. If your server is dedicated to handling
large files, a larger block size may improve performance. Block sizes cannot be changed on
the fly on existing file systems, and only a reformat will modify the current block size. Most
Linux distributions allow block sizes between 1K, 2K, and 4K. As benchmarks have shown,
there is hardly any performance improvement to be gained from changing the block size of a
file system, hence it is generally better to leave it at the default of 4K.
When a hardware RAID solution is being used, careful consideration must be given to the

stripe size of the array (or segment in the case of Fibre Channel). The stripe-unit size is the

granularity at which data is stored on one drive of the array before subsequent data is stored
on the next drive of the array. Selecting the correct stripe size is a matter of understanding the
predominant request size performed by a particular application. The stripe size of a hardware
array has, in contrast to the block size of the file system, a significant influence on the overall
disk performance.
0
20000
40000
60000
80000
100000
120000
140000
kB/sec
4 8 16 32 64 128 256 512 1024 2048
kB/op
data=ordered
data=writeback