On Mon, Mar 17, 2003 at 09:59:27AM -0500, Tom Lane wrote:
> Ah, I see: so while the freeze is on, writes to the frozen volume cost
> about 3x normal (1 write -> 1 read + 2 writes), but establishing and
> discontinuing the freeze cost nothing. And if you have a crash the
> volume is still in the proper state. Good.
I would say it cost practically nothing. The buffers are flushed to
disk, and some metadata updated, so there is a small cost.
I don't think the 3x write-cost is accurate?
What is the read for? There shouldn't be any reads as far as I can tell.
(assuming the lvm-metadata is in memory - I think it always is)
When you write to a block for the first time (after taking the snapshot)
there should be 2 writes - one to write the data, and one to update
lvm-metadata. The next time you write to the same "block" there should
only be one write. If you use large LVM-blocks (extents) there will be
only one write most of the time. (if you do sequential writes). On the
other hand, if you do random writes, large extents will waste a lot of
disk-space for your snapshot.
So, I think the write-cost should be somewhere in the range 1x-2x of
non-snapshot cost, depending on your usage.
> I would wonder though about the datastructure that LVM uses to remember
> which blocks of the frozen volume have been copied (and where) on the
> snapshot area. I assume this table lives in kernel memory --- what
> happens if it gets large?
I believe it has a fixed size.
It should take 4 bytes * (volume_size / block_size).
LVM-blocksizes are relatively large, 4 MB pr default, and for large
volumes it's common to use even bigger blocks (say 128 MB). For a 2TB
volume and 128 MB blocks the datastructure should take 32KB memory.
--
Ragnar Kjørstad
Zet.no