From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@postgresql.org
Subject: pgsql: Align buffer descriptors to cache line boundaries.
Date: Thu, 29 Jan 2015 22:20:27 +0000
Message-ID: <E1YGxRr-00063H-VA@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Align buffer descriptors to cache line boundaries.
Benchmarks has shown that aligning the buffer descriptor array to
cache lines is important for scalability; especially on bigger,
multi-socket, machines.
Currently the array sometimes already happens to be aligned by
happenstance, depending how large previous shared memory allocations
were. That can lead to wildly varying performance results after minor
configuration changes.
In addition to aligning the start of descriptor array, also force the
size of individual descriptors to be of a common cache line size (64
bytes). That happens to already be the case on 64bit platforms, but
this way we can change the struct BufferDesc more easily.
As the alignment primarily matters in highly concurrent workloads
which probably all are 64bit these days, and the space wastage of
element alignment would be a bit more noticeable on 32bit systems, we
don't force the stride to be cacheline sized on 32bit platforms for
now. If somebody does actual performance testing, we can reevaluate
that decision by changing the definition of BUFFERDESC_PADDED_SIZE.
Discussion: 20140202151319.GD32123@awork2.anarazel.de
Per discussion with Bruce Momjan, Tom Lane, Robert Haas, and Peter
Geoghegan.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/ed127002d8c592610bc8e716759a1a70657483b6
Modified Files
--------------
contrib/pg_buffercache/pg_buffercache_pages.c | 6 ++-
src/backend/storage/buffer/buf_init.c | 21 ++++----
src/backend/storage/buffer/bufmgr.c | 66 +++++++++++++------------
src/backend/storage/buffer/freelist.c | 6 +--
src/backend/storage/buffer/localbuf.c | 12 ++---
src/include/c.h | 1 +
src/include/storage/buf_internals.h | 35 ++++++++++++-
7 files changed, 93 insertions(+), 54 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de
Subject: Re: pgsql: Align buffer descriptors to cache line boundaries.
In-Reply-To: <E1YGxRr-00063H-VA@gemulon.postgresql.org>
References: <E1YGxRr-00063H-VA@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox