Sorting writes during checkpoint - Mailing list pgsql-patches

From ITAGAKI Takahiro
Subject Sorting writes during checkpoint
Date
Msg-id 20080415181742.6C97.52131E4D@oss.ntt.co.jp
Whole thread Raw
Responses Re: Sorting writes during checkpoint
List pgsql-patches
Here is a patch for TODO item, "Consider sorting writes during checkpoint".
It writes dirty buffers in the order of block number during checkpoint
so that buffers are written sequentially.

I proposed the patch before, but it was rejected because 8.3 feature
has been frozen already at that time.
http://archives.postgresql.org/pgsql-hackers/2007-06/msg00541.php

I rewrote it to be applied cleanly against current HEAD, but the concept
is not changed at all -- Memorizing pairs of (buf_id, BufferTag) for each
dirty buffer into an palloc-ed array at the start of checkpoint. Sorting
the array in BufferTag order and writing buffers in the order.

There are 10% of performance win in pgbench on my machine with RAID-0
disks. There can be more benefits on RAID-5 disks, because random writes
are slower than sequential writes there.


[HEAD]
  tps = 1134.233955 (excluding connections establishing)
[HEAD with patch]
  tps = 1267.446249 (excluding connections establishing)

[pgbench]
transaction type: TPC-B (sort of)
scaling factor: 100
query mode: simple
number of clients: 32
number of transactions per client: 100000
number of transactions actually processed: 3200000/3200000

[hardware]
2x Quad core Xeon, 16GB RAM, 4x HDD (RAID-0)

[postgresql.conf]
shared_buffers = 2GB
wal_buffers = 4MB
checkpoint_segments = 64
checkpoint_timeout = 5min
checkpoint_completion_target = 0.5

Regards,
---
ITAGAKI Takahiro
NTT Open Source Software Center


Attachment

pgsql-patches by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: [HACKERS] printTable API (was: Show INHERIT in \du)
Next
From: Greg Smith
Date:
Subject: Re: Sorting writes during checkpoint