What is a good stripe size?
I have two SCSI disks in my systems with PVs on /dev/sda2 and /dev/sdb2 (/dev/sd{a,b}1 are very small partitions for /boot and swap).
Using the PVs on sda2 and sdb2 I created a single VG and I want to create striped LVs on it now. My questions is, how large should I choose the stripe size to achive optimal performance. If I choose it too large, I will probably loose the win of striping.
What happens if I choose very small stripe size, say 1K? When I then need say 100K of contigous blocks of the LV LVM will read 50K contigously from sda2 and 50K from sdb2. But will the 50K from each of thes partitions be read in 50 reads of 1K? Will that degrade performance?
Does the optimal value of the stripe size depend on how the LV will be used and the average file size on it? My LVs will be /, /var, /var/spool/news, /usr, /usr/local, /home and /tftpboot/galois.
urs
Quoted 4 lines · Urs Thuermann
Using the PVs on sda2 and sdb2 I created a single VG and I want to create striped LVs on it now. My questions is, how large should I choose the stripe size to achive optimal performance. If I choose it too large, I will probably loose the win of striping.
You lose the advantage of striping if the stripe size is on the order of the file size. You want stripes which will be narrower than most of the files you will be using.
The ideal stripe size is a multiple of the size of the blocks in the filesystem. Reads and writes work most efficiently when they can run a block at a time, rather than having to buffer up fragments.
These two guidelines usually leave you with a stripe which is between 1-4x your block size.
If you do not know the size of the blocks in your filesystem, there is usually a filesystem tool which will tell you (dumpe2fs for ext2, debugreiserfs for reiser, etc etc).
Ex. My machine has only reiserfs. debugreiserfs tells me that the
filesystems use 4096 byte blocks. I therefore have 4096-byte wide stripes. This also accomodates ext2 (block sizes can be between 1024-4096) and most of the other available filesystems, which use multiples of 1k. It is a little wide for those which use 512 byte blocks, but I am unlikely to use such an obsolete fs for anything speed critical.
Signature · 1 line
$ fortune -m Kellen