Re: Handing off SLRU fsyncs to the checkpointer

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Handing off SLRU fsyncs to the checkpointer
Date: 2020-08-12 06:06:40
Message-ID: CA+hUKGKnTxRHj3zNixvnwn8Puu-o4mZ_bivP5xpH+0fCNSNwag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Aug 8, 2020 at 2:44 AM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Wed, Aug 5, 2020 at 2:01 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> > * Master is around 11% faster than last week before commit c5315f4f
> > "Cache smgrnblocks() results in recovery."
> > * This patch gives a similar speedup, bringing the total to around 25%
> > faster than last week (the time is ~20% less, the WAL processing speed
> > is ~1.25x).
>
> Dang, that's pretty nice, especially for the relatively small amount
> of code that it seems to require.

Yeah, the combined effect of these two patches is better than I
expected. To be clear though, I was only measuring the time between
the "redo starts at ..." and "redo done at ..." messages, since I've
been staring at the main recovery code, but there are also some more
fsyncs before (SyncDataDirectory()) and after (RemoveOldXlogFiles())
that are unaffected. I think it's probably possible to do something
about those too, but that's another topic.

I spotted a small problem: if the transaction ID wrap all the way
around between checkpoints, then you might have cancelled requests for
a removed SLRU segment from the previous epoch, so we'd better
uncancel them if we see that. That's a one line fix, done in the
attached. I also adjusted the commit message to be a little clearer
(this work deferment/collapsing scheme works in crash recovery too,
not just when there is a checkpointer process to hand the work to).

Attachment Content-Type Size
0001-Defer-flushing-of-SLRU-files.patch text/x-patch 16.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2020-08-12 06:32:39 Re: SyncRepLock acquired exclusively in default configuration
Previous Message Justin Pryzby 2020-08-12 05:28:20 Re: 回复:how to create index concurrently on partitioned table