pgsql: Checkpoint sorting and balancing.

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Checkpoint sorting and balancing.
Date: 2016-03-11 01:29:09
Message-ID: E1aeBt7-0005jP-Il@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(dot)DEB(dot)2(dot)10(dot)1506011320000(dot)28433(at)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(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Joel Jacobson 2016-03-11 01:31:56 Re: [COMMITTERS] pgsql: Provide much better wait information in pg_stat_activity.
Previous Message Amit Langote 2016-03-11 01:08:11 Re: pgsql: Don't vacuum all-frozen pages.