Re: Load distributed checkpoint - Mailing list pgsql-hackers

From ITAGAKI Takahiro
Subject Re: Load distributed checkpoint
Date
Msg-id 20061226152731.5D53.ITAGAKI.TAKAHIRO@oss.ntt.co.jp
Whole thread Raw
In response to Re: Load distributed checkpoint  (Bruce Momjian <bruce@momjian.us>)
Responses Re: Load distributed checkpoint
List pgsql-hackers
Bruce Momjian <bruce@momjian.us> wrote:

> I assume write() is not our checkpoint performance problem, but the
> transfer to disk via fsync().  Perhaps a simple solution is to do the
> write()'s of all dirty buffers as we do now at checkpoint time, but
> delay 30 seconds and then do fsync() on all the files.

I think there are two platforms that have different problems in checkpoints.
It's in fsync() on one platform, and in write() on another. It is complex
depending on OS, the amount of memory, disks, writeback-cache and so on.

> I think the basic difference between this and the proposed patch is that
> we do not put delays in the buffer write() or fsync() phases --- we just
> put a delay _between_ the phases, and wait for the kernel to smooth it
> out for us.  The kernel certainly knows more about what needs to get to
> disk, so it seems logical to let it do the I/O smoothing.

Both proposals do not conflict each other. Also, solutions for either
platform do not have bad effect on the other platform. Can we employ
both of them?

I tested your proposal but it did not work on write-critical machine.
However, if the idea works well on BSD or some platforms, we would be
better off buying it.

[pgbench results]
...
566.973777
327.158222 <- (1) write()
560.773868 <- (2) sleep
544.106645 <- (3) fsync()
...

[changes in codes] (This is a bad implementation because shutdown takes long time!)
void
FlushBufferPool(void)
{   BufferSync();                       // (1) write -- about 20s
   time_t start = time(NULL);   while (time(NULL) - start < 30)     // (2) sleep -- 30s   {
pg_usleep(BgWriterDelay* 1000L);       BgBufferSync();       AbsorbFsyncRequests();   } 
   smgrsync();                         // (3) fsync -- less than 200ms
}

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




pgsql-hackers by date:

Previous
From: "Takayuki Tsunakawa"
Date:
Subject: Re: Load distributed checkpoint
Next
From: Doug Knight
Date:
Subject: Re: pg_standby and build farm