Move "hot" members of PGPROC into a separate PGXACT array.
Robert Haas <rhaas@postgresql.org>
Move "hot" members of PGPROC into a separate PGXACT array. This speeds up snapshot-taking and reduces ProcArrayLock contention. Also, the PGPROC (and PGXACT) structures used by two-phase commit are now allocated as part of the main array, rather than in a separate array, and we keep ProcArray sorted in pointer order. These changes are intended to minimize the number of cache lines that must be pulled in to take a snapshot, and testing shows a substantial increase in performance on both read and write workloads at high concurrencies. Pavan Deolasee, Heikki Linnakangas, Robert Haas
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/transam/twophase.c | modified | +69 −46 |
| src/backend/access/transam/varsup.c | modified | +6 −5 |
| src/backend/access/transam/xact.c | modified | +2 −2 |
| src/backend/commands/analyze.c | modified | +2 −2 |
| src/backend/commands/vacuum.c | modified | +2 −2 |
| src/backend/postmaster/postmaster.c | modified | +3 −0 |
| src/backend/replication/walsender.c | modified | +1 −1 |
| src/backend/storage/ipc/ipci.c | modified | +1 −1 |
| src/backend/storage/ipc/procarray.c | modified | +171 −105 |
| src/backend/storage/lmgr/deadlock.c | modified | +3 −1 |
| src/backend/storage/lmgr/lock.c | modified | +2 −1 |
| src/backend/storage/lmgr/proc.c | modified | +62 −25 |
| src/backend/utils/time/snapmgr.c | modified | +1 −1 |
| src/include/storage/proc.h | modified | +31 −16 |