[linux-lvm] advice for curing terrible snapshot performance?

Joe Pruett joey at q7.com
Fri Nov 12 23:36:30 UTC 2010


i just did a bit of poking around and discovered that snapshots have
their own chunk size that is used for the copy on write magic.  and it
defaults to 4k, and you can only increase that to 512k.  a simple test
of creating a 1g file went from 240mbytes/sec to 4mbytes/sec with 4k
chunk, and 12mbytes/sec with 512k chunk.  so i'm not sure what the
bottleneck is, but is surely is there.

On 11/12/2010 02:28 PM, Joe Pruett wrote:
> my understanding of how the lvm does snapshots is that a write causes a
> lookup to see if that extent is dirty or clean.  a dirty extent just
> writes directly, a clean extent causes a copy from the main volume to
> the snapshot volume and some amount of bookkeeping to track that the
> block is now dirty and then the write completes to the main lv.  so a
> test where you are creating a bunch of updates would cause a write to
> turn into a read and two writes, so i'd expect more like a 3x hit.  and
> i guess that the bookkeeping may have some sync calls in it, which could
> cause some major stalls as caches flush.
>
> have you tested the snapshots under normal load, and not test load?  you
> may be seeing the worst possible behavior (which is good to know), but
> may not really occur under typical usage.




More information about the linux-lvm mailing list