Re: Postgresql 9.4 and ZFS?

From: Keith Fiske <keith(at)omniti(dot)com>
To: Benjamin Smith <ben(at)chico(dot)com>
Cc: PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgresql 9.4 and ZFS?
Date: 2015-09-30 19:49:44
Message-ID: CAG1_KcD_hJ6zzn0muLNyYnNg90tKzvGpCdz=DB+o_Pz6izJMyQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Sep 29, 2015 at 1:01 PM, Benjamin Smith <ben(at)chico(dot)com> wrote:

> Does anybody here have any recommendations for using PostgreSQL 9.4
> (latest)
> with ZFS?
>
> We've been running both on ZFS/CentOS 6 with excellent results, and are
> considering putting the two together. In particular, the CoW nature (and
> subsequent fragmentation/thrashing) of ZFS becomes largely irrelevant on
> SSDs;
> the very act of wear leveling on an SSD is itself a form of intentional
> thrashing that doesn't affect performance since SSDs have no meaningful
> seek
> time. It would seem that PGCon 2013 even had a workshop on it!
> https://www.pgcon.org/2013/schedule/events/612.en.html
>
> The exact configuration we're contemplating is either (3x 400 RAIDZ1) or
> (4x
> 400 RAIDZ2) with Intel Enterprise SATA3 SSDs, with default (lz4)
> compression
> enabled.
>
> If this is a particularly good or bad idea, I'd like to hear it, and why?
>
> Thanks,
>
> BenP
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

We've run postgres on ZFS for years with great success (first on
OpenSolaris, now on OmniOS, and I personally run it on FreeBSD). The
snapshotting feature makes upgrades on large clusters much less scary
(snapshot and revert if it goes bad) and being able to bring a snapshot
backup up as a clone to restore an accidentally dropped table is great.

Others have given a lot of great advice as far as system tuning. Only other
thing I can add is you definitely do want your data directory on its own
pool. But I recommend putting the actual data in a folder under that pool
(possibly by major version name). For example if your pool is

/data/postgres

Create a folder under that directory to actually put the data:

mkdir /data/postgres/9.4

This allows pg_upgrade's --link option to work during major upgrades since
you can't have an upgrade destination on a different filesystem. Just make
a 9.5 directory in the same spot when the time comes around. With ZFS
snapshots available, there's really no reason not to use the --link option
to greatly speed up upgrades.

--
Keith Fiske
Database Administrator
OmniTI Computer Consulting, Inc.
http://www.keithf4.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tomas Vondra 2015-09-30 19:58:08 Re: Postgresql 9.4 and ZFS?
Previous Message Benjamin Smith 2015-09-30 17:33:18 Re: Postgresql 9.4 and ZFS?