Skip site navigation (1) Skip section navigation (2)

Re: Two hard drives --- what to do with them?

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Peter Kovacs <maxottovonstirlitz(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Carlos Moreno <moreno_pg(at)mochima(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Two hard drives --- what to do with them?
Date: 2007-02-27 00:25:14
Message-ID: 1172535914.10824.327.camel@dogma.v10.wvs (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
On Tue, 2007-02-27 at 01:11 +0100, Peter Kovacs wrote:
> On 2/26/07, Jeff Davis <pgsql(at)j-davis(dot)com> wrote:
> > On Sun, 2007-02-25 at 23:11 +0100, Peter Kovacs wrote:
> > > A related question:
> > > Is it sufficient to disable write cache only on the disk where pg_xlog
> > > is located? Or should write cache be disabled on both disks?
> > >
> >
> > When PostgreSQL does a checkpoint, it thinks the data pages before the
> > checkpoint have successfully made it to disk.
> >
> > If the write cache holds those data pages, and then loses them, there's
> > no way for PostgreSQL to recover. So use a battery backed cache or turn
> > off the write cache.
> Sorry for for not being familar with storage techonologies... Does
> "battery" here mean battery in the common sense of the word - some
> kind of independent power supply? Shouldn't the disk itself be backed
> by a battery? As should the entire storage subsystem?

Yes, a battery that can hold power to keep data alive in the write cache
in case of power failure, etc., for a long enough time to recover and
commit the data to disk.

So, a write cache is OK (even for pg_xlog) if it is durable (i.e. on
permanent storage or backed by enough power to make sure it gets there).
However, if PostgreSQL has no way to know whether a write is durable or
not, it can't guarantee the data is safe.

The reason this becomes an issue is that many consumer-grade disks have
write cache enabled by default and no way to make sure the cached data
actually gets written. So, essentially, these disks "lie" and say they
wrote the data, when in reality, it's in volatile memory. It's
recommended that you disable write cache on such a device.

	Jeff Davis

In response to


pgsql-performance by date

Next:From: ITAGAKI TakahiroDate: 2007-02-27 03:05:57
Subject: Dead Space Map version 2
Previous:From: Peter KovacsDate: 2007-02-27 00:11:24
Subject: Re: Two hard drives --- what to do with them?

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group