From: Ragnar Kjørstad <postgres@ragnark.vestdata.no>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Matt Clark <matt@ymogen.net>
Cc: Peter Eisentraut <peter_e@gmx.net>
Cc: Murthy Kambhampaty <murthy.kambhampaty@goeci.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: LVM snapshots
Date: Mon, 17 Mar 2003 16:26:30 +0100
Message-ID: <20030317152630.GB23149@vestdata.no> (raw)
In-Reply-To: <6139.1047913167@sss.pgh.pa.us>
References: <OAEAKHEHCMLBLIDGAFELEEDJDBAA.matt@ymogen.net>
<6139.1047913167@sss.pgh.pa.us>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: postgres@ragnark.vestdata.no, tgl@sss.pgh.pa.us, matt@ymogen.net, peter_e@gmx.net, murthy.kambhampaty@goeci.com
Subject: Re: LVM snapshots
In-Reply-To: <20030317152630.GB23149@vestdata.no>
References: <OAEAKHEHCMLBLIDGAFELEEDJDBAA.matt@ymogen.net> <6139.1047913167@sss.pgh.pa.us> <20030317152630.GB23149@vestdata.no>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox