pgsql: Make backend local tracking of buffer pins memory efficient.

Поиск
Список
Период
Сортировка
От Andres Freund
Тема pgsql: Make backend local tracking of buffer pins memory efficient.
Дата
Msg-id E1XNhO6-0006R3-ND@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Make backend local tracking of buffer pins memory efficient.

Since the dawn of time (aka Postgres95) multiple pins of the same
buffer by one backend have been optimized not to modify the shared
refcount more than once. This optimization has always used a NBuffer
sized array in each backend keeping track of a backend's pins.

That array (PrivateRefCount) was one of the biggest per-backend memory
allocations, depending on the shared_buffers setting. Besides the
waste of memory it also has proven to be a performance bottleneck when
assertions are enabled as we make sure that there's no remaining pins
left at the end of transactions. Also, on servers with lots of memory
and a correspondingly high shared_buffers setting the amount of random
memory accesses can also lead to poor cpu cache efficiency.

Because of these reasons a backend's buffers pins are now kept track
of in a small statically sized array that overflows into a hash table
when necessary. Benchmarks have shown neutral to positive performance
results with considerably lower memory usage.

Patch by me, review by Robert Haas.

Discussion: 20140321182231.GA17111@alap3.anarazel.de

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/4b4b680c3d6d8485155d4d4bf0a92d3a874b7a65

Modified Files
--------------
contrib/pg_buffercache/pg_buffercache_pages.c |    2 +-
src/backend/storage/buffer/buf_init.c         |   39 +--
src/backend/storage/buffer/bufmgr.c           |  418 +++++++++++++++++++++++--
src/include/storage/bufmgr.h                  |   19 --
4 files changed, 391 insertions(+), 87 deletions(-)


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: pgsql: Update C comment for pg_attribute.attislocal
Следующее
От: Bruce Momjian
Дата:
Сообщение: pgsql: Again update C comments for pg_attribute.attislocal