pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Marc Cousin <cousinmarc@gmail.com>
To: pgsql-performance@postgresql.org
Subject: performance regression with Linux 2.6.33 and glibc 2.12
Date: Fri, 4 Jun 2010 15:39:03 +0200
Message-ID: <201006041539.03868.cousinmarc@gmail.com> (raw)

Hi.

I hope I'm not going to expose an already known problem, but I couldn't find 
it mailing list archives (I only found http://archives.postgresql.org/pgsql-
hackers/2009-12/msg01543.php).

On one of my (non production) machines, I've just seen a very big performance 
regression (I was doing a very simple insert test). I had an 'old' 8.4 
postgresql compiled a few month ago, performing very well, and my 'bleeding 
edge' 9.0, doing the same insert very slowly.

I managed to find the cause of the regression : with Linux 2.6.33, O_DSYNC is 
now available. With glibc 2.12, O_DSYNC is available in userspace. Having both 
(they are both very new, 2.12 isn't even official on glibc website), my new 
build defaulted to open_datasync. The problem is that it is much slower. I 
tested it on 2 small machines (no big raid, just basic machines, with SATA or 
software RAID).

Here is the trivial test :
The configuration is the default configuration, just after initdb

CREATE TABLE test (a int);
CREATE INDEX idxtest on test (a);



with wal_sync_method = open_datasync (new default)

marc=# INSERT INTO test SELECT generate_series(1,100000);
INSERT 0 100000
Time: 16083,912 ms

with wal_sync_method = fdatasync (old default)

marc=# INSERT INTO test SELECT generate_series(1,100000);
INSERT 0 100000
Time: 954,000 ms

Doing synthetic benchmarks with test_fsync:

open_datasync performance, glibc 2.12, 2.6.34, 1 SATA drive

Simple 8k write timing:
write                           0.037511

Compare file sync methods using one 8k write:
open_datasync write            56.998797
open_sync write               168.653995
write, fdatasync               55.359279
write, fsync                  166.854911

Compare file sync methods using two 8k writes:
open_datasync write, write    113.342738
open_sync write, write        339.066883
write, write, fdatasync        57.336820
write, write, fsync           166.847923

Compare open_sync sizes:                                                                                                                                                                       
16k open_sync write           169.423723                                                                                                                                               
2 8k open_sync writes         336.457119                                                                                                                                               

Compare fsync times on write() and new file descriptors (if the times
are similar, fsync() can sync data written on a different descriptor):
write, fsync, close           166.264048
write, close, fsync           168.702035

This is it, I just wanted to raise an alert on this: the degradation was 16-
fold with this test. We wont see linux 2.6.33 + glibc 2.12 in production 
before months (I hope), but shouldn't PostgreSQL use fdatasync by default with 
Linux, seeing the result ?

By the way, I re-did my tests with both 2.6.33, 2.6.34 and 2.6.35-rc1 and got 
the exact same result (O_DSYNC there, obviously, but also the performance 
degradation).

Cheers

Marc



view thread (4+ messages)  latest in thread

Message-ID: <201006041539.03868.cousinmarc@gmail.com>
Permalink:  ../201006041539.03868.cousinmarc@gmail.com/
Also on:    postgresql.org/message-id/201006041539.03868.cousinmarc@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: cousinmarc@gmail.com
  Subject: Re: performance regression with Linux 2.6.33 and glibc 2.12
  In-Reply-To: <201006041539.03868.cousinmarc@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox