Thread: ext3 journalling type

ext3 journalling type

From
Dawid Kuroczko
Date:
The ext3fs allows to selet type of journalling to be used with
filesystem.  Journalling pretty much "mirrors" the work of WAL
logging by PostgreSQL...  I wonder which type of journalling
is best for PgSQL in terms of performance.
Choices include:
              journal
                     All data is committed into the  journal  prior  to  being
                     written into the main file system.
              ordered
                     This  is  the  default mode.  All data is forced directly
                     out to the main file system prior to its  metadata  being
                     committed to the journal.
              writeback
                     Data ordering is not preserved - data may be written into
                     the main file system after its metadata has been  commit-
                     ted  to the journal.  This is rumoured to be the highest-
                     throughput option.  It guarantees  internal  file  system
                     integrity,  however  it  can  allow old data to appear in
                     files after a crash and journal recovery.

Am I right to assume that "writeback" is both fastest and at the same
time as safe to use as ordered?  Maybe any of you did some benchmarks?

Regards,
     Dawid

Re: ext3 journalling type

From
Bruce Momjian
Date:
Dawid Kuroczko wrote:
> The ext3fs allows to selet type of journalling to be used with
> filesystem.  Journalling pretty much "mirrors" the work of WAL
> logging by PostgreSQL...  I wonder which type of journalling
> is best for PgSQL in terms of performance.
> Choices include:
>               journal
>                      All data is committed into the  journal  prior  to  being
>                      written into the main file system.
>               ordered
>                      This  is  the  default mode.  All data is forced directly
>                      out to the main file system prior to its  metadata  being
>                      committed to the journal.
>               writeback
>                      Data ordering is not preserved - data may be written into
>                      the main file system after its metadata has been  commit-
>                      ted  to the journal.  This is rumoured to be the highest-
>                      throughput option.  It guarantees  internal  file  system
>                      integrity,  however  it  can  allow old data to appear in
>                      files after a crash and journal recovery.
>
> Am I right to assume that "writeback" is both fastest and at the same
> time as safe to use as ordered?  Maybe any of you did some benchmarks?

Yes.  I have seen benchmarks that say writeback is fastest but I don't
have any numbers handy.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Re: ext3 journalling type

From
"Matt Clark"
Date:
> Am I right to assume that "writeback" is both fastest and at
> the same time as safe to use as ordered?  Maybe any of you
> did some benchmarks?

It should be fastest because it is the least overhead, and safe because
postgres does it's own write-order guaranteeing through fsync().  You should
also mount the FS with the 'noatime' option.

But....  For some workloads, there are tests showing that 'data=journal' can
be the fastest!  This is because although the data is written twice (once to
the journal, and then to its real location on disk) in this mode data is
written _sequentially_ to the journal, and later written out to its
destination, which may be at a quieter time.

There's a discussion (based around 7.2) here:
http://www.kerneltraffic.org/kernel-traffic/kt20020401_160.txt

M


Re: ext3 journalling type

From
Mark Wong
Date:
I have some data here, no detailed analyses though:

    http://www.osdl.org/projects/dbt2dev/results/fs/

Mark

On Mon, Nov 08, 2004 at 01:26:09PM +0100, Dawid Kuroczko wrote:
> The ext3fs allows to selet type of journalling to be used with
> filesystem.  Journalling pretty much "mirrors" the work of WAL
> logging by PostgreSQL...  I wonder which type of journalling
> is best for PgSQL in terms of performance.
> Choices include:
>               journal
>                      All data is committed into the  journal  prior  to  being
>                      written into the main file system.
>               ordered
>                      This  is  the  default mode.  All data is forced directly
>                      out to the main file system prior to its  metadata  being
>                      committed to the journal.
>               writeback
>                      Data ordering is not preserved - data may be written into
>                      the main file system after its metadata has been  commit-
>                      ted  to the journal.  This is rumoured to be the highest-
>                      throughput option.  It guarantees  internal  file  system
>                      integrity,  however  it  can  allow old data to appear in
>                      files after a crash and journal recovery.
>
> Am I right to assume that "writeback" is both fastest and at the same
> time as safe to use as ordered?  Maybe any of you did some benchmarks?
>
> Regards,
>      Dawid
>


Re: ext3 journalling type

From
Josh Berkus
Date:
Matt,

> It should be fastest because it is the least overhead, and safe because
> postgres does it's own write-order guaranteeing through fsync().  You
> should also mount the FS with the 'noatime' option.

This, of course, assumes that PostgreSQL is the only thing on the partition.
Which is a good idea in general, but not to be taken for granted ...

--
Josh Berkus
Aglio Database Solutions
San Francisco