Skip site navigation (1) Skip section navigation (2)

Re: WAL Performance Improvements

From: Janardhana Reddy <jana-reddy(at)mediaring(dot)com(dot)sg>
To: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>,janareddy <jana-reddy(at)mediaring(dot)com(dot)sg>
Subject: Re: WAL Performance Improvements
Date: 2002-02-26 07:03:54
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
Tom Lane wrote:

> Janardhana Reddy <jana-reddy(at)mediaring(dot)com(dot)sg> writes:
> >   I've attached a patch  which should improve the performance of WAL by
> > reducing the fsync time
> >  and write time by 50%(if OS page size is 4k) , if the transaction
> > generate the WAL data  less then 4k. Instead of
> >  writing every time  8k data in to the WAL file  it will write only the
> > portion of the data which
> >  as changed from the last time(Example : if transaction generates 150
> > bytes of WAL data ,then it writes
> >  only 150 bytes instead of 8k).
> As near as I can tell, this breaks WAL by failing to ensure that the
> rest of the current page is zeroed.  After crash and recovery, you might
> read obsolete WAL records (written during the previous cycle of life
> of the WAL segment file) and think they are valid.
> I'd also be interested to see the measurements backing up the claim of 50%
> performance improvement.  That'd depend very largely on the filesystem block
> size, no?
>                         regards, tom lane

      I have done some changes to patch  to overcome the "WAL failing to ensure
that the
rest of the current page is zeroed".  for every write to the WAL empty
record(32 bytes with zero value )  is appended so that
 at the  time of REDO it  can see the record with zero length in all cases.

   Test Results with Latest patch :
          environment:  Intel PC ,IDE (harddisk),Linux Kernel 2.4.0 (OS
Version). Single
                connection is connected to the database and pumping
continously insert statements. each insert
               generates 160 bytes  to WAL Log.

           With out applying the Patch :
                                         Transaction Per Second :     332 TPS
                                         Time Taken by fdatasync :  2160
                                          Time taken by  write :    61
             After applying the patch :
                                            Transaction Per Second : 435 TPS
                                            Time Taken by fdatasync :  512
                                             Time Taken by write :  42 usec/sec

I've attached latest patch and xlog.c .


Attachment: patch_xlog
Description: text/plain (2.9 KB)
Attachment: xlog.c
Description: text/plain (97.2 KB)

In response to


pgsql-hackers by date

Next:From: Bradley BaetzDate: 2002-02-26 08:09:55
Subject: Re: [SQL] query optimistaion problems
Previous:From: KevinDate: 2002-02-26 04:54:53
Subject: Re: Duration of beta period

pgsql-patches by date

Next:From: Christopher Kings-LynneDate: 2002-02-26 08:36:42
Subject: minor doc patch for example in 'SET' docs
Previous:From: Bruce MomjianDate: 2002-02-26 04:11:59
Subject: Re: Fix issuing of multiple command completions per command

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group