pgsql: Align buffer descriptors to cache line boundaries.

Поиск
Список
Период
Сортировка
От Andres Freund
Тема pgsql: Align buffer descriptors to cache line boundaries.
Дата
Msg-id E1YGxRr-00063H-VA@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-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(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: pgsql: Properly terminate the array returned by GetLockConflicts().
Следующее
От: Andres Freund
Дата:
Сообщение: pgsql: Fix #ifdefed'ed out code to compile again.