[mythtv-users] LVM2 Striping Suggestions...

Richard Freeman r-mythtv at thefreemanclan.net
Sat Sep 23 12:57:08 UTC 2006

Andy Speagle wrote:
> I want to setup the LV using striping
> across the two drives to take advantage of concurrent I/O on both
> spindles... 

Actually, the thing I really wished that LVM had was something I'd call
"chunking" instead of striping.  The user would specify a chunk size
(maybe 50MB for common use, or 0.5-1GB for myth), and the drive would
store each chunk on a single drive, and each consecutive chunk on
sequential drives.  So, logical drive throughput for a single file is
only that of a single drive, and if a drive fails you end up with a LOT
of files completely intact.  On the other hand, if you access two random
files on the same logical drive there is a good chance that they're on
different physical drives, so head seeking is greatly lowered and data
throughput rises to the total drive throughput if all drives are in use.

Unless you're recording uncompressed HD you don't actually need all that
much single-file throughput from your drives - if you're playing 3 5Mbps
streams then you only need 15Mbps of throughput.  The bigger issue with
something like myth is head-seeking - if those files are scattered on a
single physical drive then the head must seek.   With striping you
GUARANTEE that every file is on EVERY drive - so you will always have
competition for the drive head when reading multiple files
simultaneously.  If you could instead try to distribute files randomly
across drives you'd reduce this competition, as drives might only have
one file being requested on them and could read this file at full
throughput for a long time.

Think of it this way - striping gives you a much higher
single-file-access speed.  A pattern which keeps data for individual
files on a single drive, but which distributes different files across
drives would have lower maximum burst speed for an individual file, but
a higher sustained throughput when multiple files are being read at once.

Granted, if these drives are ONLY doing mythtv you probably won't have
issues unless you have 14 front ends and 12 tuners or something like
that.  Things become more of an issue if you're also using these drives
for other tasks (which are more likely to cause head movement than
seeking along a few 1GB MPEG files).  Having more free RAM also helps -
a file server with lots of free RAM will undoubtedly do some read-ahead
and write caching which will reduce head thrashing (especially with a
filesystem like xfs which tends to hang onto dirty buffers).

In theory there is no reason that LVM can't arrange the logical clusters
in any way the user might like - I believe it really is just a lookup
table mapping logical clusters to physical clusters.   Striping and
linear are only two of many possible ways to setup the map.  I'm sure a
better computer scientist than I could figure out the best possible
arrangement for any use scenario...

More information about the mythtv-users mailing list