pgsql: Checkpoint sorting and balancing. - Mailing list pgsql-committers

From Andres Freund
Subject pgsql: Checkpoint sorting and balancing.
Date
Msg-id E1aeBt7-0005jP-Il@gemulon.postgresql.org
Whole thread Raw
Responses Re: pgsql: Checkpoint sorting and balancing.  (Peter Eisentraut <peter_e@gmx.net>)
Re: pgsql: Checkpoint sorting and balancing.  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-committers
Checkpoint sorting and balancing.

Up to now checkpoints were written in the order they're in the
BufferDescriptors. That's nearly random in a lot of cases, which
performs badly on rotating media, but even on SSDs it causes slowdowns.

To avoid that, sort checkpoints before writing them out. We currently
sort by tablespace, relfilenode, fork and block number.

One of the major reasons that previously wasn't done, was fear of
imbalance between tablespaces. To address that balance writes between
tablespaces.

The other prime concern was that the relatively large allocation to sort
the buffers in might fail, preventing checkpoints from happening. Thus
pre-allocate the required memory in shared memory, at server startup.

This particularly makes it more efficient to have checkpoint flushing
enabled, because that'll often result in a lot of writes that can be
coalesced into one flush.

Discussion: alpine.DEB.2.10.1506011320000.28433@sto
Author: Fabien Coelho and Andres Freund

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/9cd00c457e6a1ebb984167ac556a9961812a683c

Modified Files
--------------
src/backend/storage/buffer/README     |   5 -
src/backend/storage/buffer/buf_init.c |  22 ++-
src/backend/storage/buffer/bufmgr.c   | 274 +++++++++++++++++++++++++++++-----
src/include/storage/buf_internals.h   |  18 +++
src/tools/pgindent/typedefs.list      |   2 +
5 files changed, 277 insertions(+), 44 deletions(-)


pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: Allow to trigger kernel writeback after a configurable number of
Next
From: Peter Eisentraut
Date:
Subject: Re: pgsql: Checkpoint sorting and balancing.