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: 3C7B3359.508B3A5E@mediaring.com.sg
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-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

Hi,
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
usec/call
Time taken by write : 61
usec/call
After applying the patch :
Transaction Per Second : 435 TPS
Time Taken by fdatasync : 512
usec/sec
Time Taken by write : 42 usec/sec

I've attached latest patch and xlog.c .

Regards
jana

Attachment Content-Type Size
patch_xlog text/plain 2.9 KB
xlog.c text/plain 97.2 KB

In response to

Responses

Browse pgsql-hackers by date

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

Browse pgsql-patches by date

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