pgsql: Reduce ProcArrayLock contention by removing backends in batches.
От | Robert Haas |
---|---|
Тема | pgsql: Reduce ProcArrayLock contention by removing backends in batches. |
Дата | |
Msg-id | E1ZNNg0-0003hW-Kz@gemulon.postgresql.org обсуждение исходный текст |
Список | pgsql-committers |
Reduce ProcArrayLock contention by removing backends in batches. When a write transaction commits, it must clear its XID advertised via the ProcArray, which requires that we hold ProcArrayLock in exclusive mode in order to prevent concurrent processes running GetSnapshotData from seeing inconsistent results. When many processes try to commit at once, ProcArrayLock must change hands repeatedly, with each concurrent process trying to commit waking up to acquire the lock in turn. To make things more efficient, when more than one backend is trying to commit a write transaction at the same time, have just one of them acquire ProcArrayLock in exclusive mode and clear the XIDs of all processes in the group. Benchmarking reveals that this is much more efficient at very high client counts. Amit Kapila, heavily revised by me, with some review also from Pavan Deolasee. Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/0e141c0fbb211bdd23783afa731e3eef95c9ad7a Modified Files -------------- src/backend/access/transam/README | 3 + src/backend/storage/ipc/procarray.c | 166 ++++++++++++++++++++++++++++++----- src/backend/storage/lmgr/proc.c | 5 ++ src/include/storage/proc.h | 12 +++ 4 files changed, 166 insertions(+), 20 deletions(-)
В списке pgsql-committers по дате отправления: