- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit4b4b680
committed
Make backend local tracking of buffer pins memory efficient.
Since the dawn of time (aka Postgres95) multiple pins of the samebuffer by one backend have been optimized not to modify the sharedrefcount more than once. This optimization has always used a NBuffersized array in each backend keeping track of a backend's pins.That array (PrivateRefCount) was one of the biggest per-backend memoryallocations, depending on the shared_buffers setting. Besides thewaste of memory it also has proven to be a performance bottleneck whenassertions are enabled as we make sure that there's no remaining pinsleft at the end of transactions. Also, on servers with lots of memoryand a correspondingly high shared_buffers setting the amount of randommemory accesses can also lead to poor cpu cache efficiency.Because of these reasons a backend's buffers pins are now kept trackof in a small statically sized array that overflows into a hash tablewhen necessary. Benchmarks have shown neutral to positive performanceresults with considerably lower memory usage.Patch by me, review by Robert Haas.Discussion: 20140321182231.GA17111@alap3.anarazel.de1 parentc6eaa88 commit4b4b680
File tree
4 files changed
+391
-87
lines changed- contrib/pg_buffercache
- src
- backend/storage/buffer
- include/storage
4 files changed
+391
-87
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
37 | 37 |
| |
38 | 38 |
| |
39 | 39 |
| |
40 |
| - | |
| 40 | + | |
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
|
Lines changed: 3 additions & 36 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
23 |
| - | |
24 | 23 |
| |
25 | 24 |
| |
26 | 25 |
| |
| |||
50 | 49 |
| |
51 | 50 |
| |
52 | 51 |
| |
53 |
| - | |
54 |
| - | |
55 |
| - | |
56 |
| - | |
57 |
| - | |
58 |
| - | |
59 |
| - | |
60 |
| - | |
61 |
| - | |
62 |
| - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
63 | 55 |
| |
64 | 56 |
| |
65 | 57 |
| |
| |||
129 | 121 |
| |
130 | 122 |
| |
131 | 123 |
| |
132 |
| - | |
133 |
| - | |
134 |
| - | |
135 |
| - | |
136 |
| - | |
137 |
| - | |
138 |
| - | |
139 |
| - | |
140 |
| - | |
141 |
| - | |
142 |
| - | |
143 |
| - | |
144 |
| - | |
145 |
| - | |
146 |
| - | |
147 |
| - | |
148 |
| - | |
149 |
| - | |
150 |
| - | |
151 |
| - | |
152 |
| - | |
153 |
| - | |
154 |
| - | |
155 |
| - | |
156 |
| - | |
157 | 124 |
| |
158 | 125 |
| |
159 | 126 |
| |
|
0 commit comments
Comments
(0)