Re: LVM snapshots

Поиск
Список
Период
Сортировка
От Ragnar Kjørstad
Тема Re: LVM snapshots
Дата
Msg-id 20030317152630.GB23149@vestdata.no
обсуждение исходный текст
Ответ на Re: LVM snapshots  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: LVM snapshots  ("Matt Clark" <matt@ymogen.net>)
Список pgsql-admin
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

В списке pgsql-admin по дате отправления:

Предыдущее
От: "Matt Clark"
Дата:
Сообщение: Re: LVM snapshots
Следующее
От: Victor Yegorov
Дата:
Сообщение: Re: DB archiving