Re: Best setup for RAM drive - Mailing list pgsql-hackers

From Josh Berkus
Subject Re: Best setup for RAM drive
Date
Msg-id 200303050925.30405.josh@agliodbs.com
Whole thread Raw
In response to Best setup for RAM drive  (Chris Sutton <chris@smoothcorp.com>)
List 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


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: PGTTY?
Next
From: Bruce Momjian
Date:
Subject: Re: [PATCHES] Non-colliding auto generated names