X-Original-To: pgsql-admin@postgresql.org Received: from stine.vestdata.no (stine.vestdata.no [195.204.68.10]) by postgresql.org (Postfix) with ESMTP id AF3B2474E53 for ; Mon, 17 Mar 2003 10:26:32 -0500 (EST) Received: (from ragnark@localhost) by stine.vestdata.no (8.11.6/8.11.6) id h2HFQU102814; Mon, 17 Mar 2003 16:26:30 +0100 Date: Mon, 17 Mar 2003 16:26:30 +0100 From: Ragnar =?iso-8859-15?Q?Kj=F8rstad?= To: Tom Lane Cc: Matt Clark , Peter Eisentraut , Murthy Kambhampaty , pgsql-admin@postgresql.org Subject: Re: LVM snapshots Message-ID: <20030317152630.GB23149@vestdata.no> References: <6139.1047913167@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6139.1047913167@sss.pgh.pa.us> User-Agent: Mutt/1.5.2i X-Archive-Number: 200303/259 X-Sequence-Number: 7899 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