Re: Best setup for RAM drive

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: chris(at)smoothcorp(dot)com
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Best setup for RAM drive
Date: 2003-03-05 17:25:30
Message-ID: 200303050925.30405.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Chris,

> The concern of course is if something happends to the RAM drive we are
> S.O.L. and have to go to the last backup (pg_dump happens each night).

This is the drawback to RAM drives, period. If there was some way to use a
RAM drive without risking your data, everyone would do it (or at least
everyone who can afford it).

I'd reccommend backing up your database every 15 or 30 minutes. Then when a
power-out happens, you lose at most 25-45 minutes worth of data. PG_Dump is
very fast -- if your database is on a RAM drive and being backed up to a
second server over fast ethernet, I wouldn't be surprised if it takes no more
than 2-3 minutes to back up.

If this is a high-transaction database (where INSERTS and UPDATES are
constant, like 600/minute), then putting the WAL files (the pg_xlog)
directory on the RAM drive would speed up transaction processing
considerably, as much as 2x. However, this still puts you at risk of
database corruption in the event of an unxepected power-out.

Mostly, you just need a really good UPS strategy ... ideally, this machine
should be attached to a UPS giving it at least 30 minutes of live time in the
event of a power-out, and software on the machine that will flush the RAM
drive to a special partition before shutting down.

--
Josh Berkus
Aglio Database Solutions
San Francisco

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-03-05 19:37:36 Re: [PATCHES] Non-colliding auto generated names
Previous Message Peter Eisentraut 2003-03-05 17:13:35 PGTTY?