Options for fsync?

Поиск
Список
Период
Сортировка
Искать

Options for fsync?

От:
A B <gentosaker@gmail.com>
Дата:
Hi there!

I'm trying to comprehend the current status of filesystem settings and
PostgreSQL settings.

If I run on a machine (using Linux and ext3) with no battery backed
raid controller then I should use fsync=on and disable the write cache
on my harddrives  to avoid corruption.

If I had a controller with battery, then I could use fsync=off, but I
should still disable the write cache?

Re: Options for fsync?

От:
John R Pierce <pierce@hogranch.com>
Дата:
A B wrote:
> Hi there!
>
> I'm trying to comprehend the current status of filesystem settings and
> PostgreSQL settings.
>
> If I run on a machine (using Linux and ext3) with no battery backed
> raid controller then I should use fsync=on and disable the write cache
> on my harddrives  to avoid corruption.
>
> If I had a controller with battery, then I could use fsync=off, but I
> should still disable the write cache?
>   


no, you would still want fsync on, otherwise commits are left in main 
memory.     fsync forces the commits to be written to the controller 
cache which has the battery.    most of the raid systems I've used that 
battery backed cache have storage media with proper cache flushing, and 
the raid controller issues the appropriate commands to insure the 
on-drive buffers get flushed too.  Its usually when you use cheap 
desktop SATA that you can get into trouble, as long as you're using 
proper server grade storage like SAS, FC, SCSI, it generally works right.


Re: Options for fsync?

От:
Greg Smith <greg@2ndquadrant.com>
Дата:
A B wrote:
> If I had a controller with battery, then I could use fsync=off, but I
> should still disable the write cache?
>   

Never turn fsync=off.  Always disable any write cache on the drives 
themselves; most good battery-backed RAID controllers will do that for 
you.  So long as the battery continues to work, you can keep the write 
cache on the controller itself enabled, and in fact you have to do so in 
order to get good commit performance.  Given that eventually all 
batteries fail, the better cards on the market actually make that an 
explicit setting, which is the safest setting if available:  write-back 
cache enabled when battery works, write-through [cache disabled] if doesn't.

Make sure you setup monitoring alerts via e-mail for drive and battery 
failures too; test them out by yanking at drive before the server goes 
into production if you can.

-- 
Greg Smith  2ndQuadrant US  Baltimore, MD
PostgreSQL Training, Services and Support
greg@2ndQuadrant.com   www.2ndQuadrant.us

FAQ