forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit98a64d0
committed
Introduce WaitEventSet API.
Commitac1d794 ("Make idle backends exit if the postmaster dies.")introduced a regression on, at least, large linux systems. Constantlyadding the same postmaster_alive_fds to the OSs internal datastructuresfor implementing poll/select can cause significant contention; leadingto a performance regression of nearly 3x in one example.This can be avoided by using e.g. linux' epoll, which avoids having toadd/remove file descriptors to the wait datastructures at a high rate.Unfortunately the current latch interface makes it hard to allocate anypersistent per-backend resources.Replace, with a backward compatibility layer, WaitLatchOrSocket with anew WaitEventSet API. Users can allocate such a Set across multiplecalls, and add more than one file-descriptor to wait on. The latter hasbeen added because there's upcoming postgres features where that will behelpful.In addition to the previously existing poll(2), select(2),WaitForMultipleObjects() implementations also provide an epoll_wait(2)based implementation to address the aforementioned performanceproblem. Epoll is only available on linux, but that is the most likelyOS for machines large enough (four sockets) to reproduce the problem.To actually address the aforementioned regression, create and use along-lived WaitEventSet for FE/BE communication. There are additionalplaces that would benefit from a long-lived set, but that's a task foranother day.Thanks to Amit Kapila, who helped make the windows code I blindly wroteactually work.Reported-By: Dmitry Vasilyev Discussion:CAB-SwXZh44_2ybvS5Z67p_CDz=XFn4hNAD=CnMEF+QqkXwFrGg@mail.gmail.com20160114143931.GG10941@awork2.anarazel.de1 parent72e2d21 commit98a64d0
File tree
10 files changed
+1171
-530
lines changed- src
- backend
- libpq
- storage/ipc
- utils/init
- include
- libpq
- storage
- tools/pgindent
10 files changed
+1171
-530
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10193 | 10193 |
| |
10194 | 10194 |
| |
10195 | 10195 |
| |
10196 |
| - | |
| 10196 | + | |
10197 | 10197 |
| |
10198 | 10198 |
| |
10199 | 10199 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1183 | 1183 |
| |
1184 | 1184 |
| |
1185 | 1185 |
| |
1186 |
| - | |
| 1186 | + | |
1187 | 1187 |
| |
1188 | 1188 |
| |
1189 | 1189 |
| |
|
Lines changed: 12 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
140 | 140 |
| |
141 | 141 |
| |
142 | 142 |
| |
143 |
| - | |
| 143 | + | |
144 | 144 |
| |
145 | 145 |
| |
146 | 146 |
| |
147 |
| - | |
148 |
| - | |
149 |
| - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
150 | 150 |
| |
151 | 151 |
| |
152 | 152 |
| |
| |||
165 | 165 |
| |
166 | 166 |
| |
167 | 167 |
| |
168 |
| - | |
| 168 | + | |
169 | 169 |
| |
170 | 170 |
| |
171 | 171 |
| |
172 | 172 |
| |
173 | 173 |
| |
174 |
| - | |
| 174 | + | |
175 | 175 |
| |
176 | 176 |
| |
177 | 177 |
| |
| |||
241 | 241 |
| |
242 | 242 |
| |
243 | 243 |
| |
244 |
| - | |
| 244 | + | |
245 | 245 |
| |
246 | 246 |
| |
247 | 247 |
| |
248 |
| - | |
249 |
| - | |
250 |
| - | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
251 | 251 |
| |
252 | 252 |
| |
253 |
| - | |
| 253 | + | |
254 | 254 |
| |
255 | 255 |
| |
256 | 256 |
| |
257 | 257 |
| |
258 | 258 |
| |
259 |
| - | |
| 259 | + | |
260 | 260 |
| |
261 | 261 |
| |
262 | 262 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
201 | 201 |
| |
202 | 202 |
| |
203 | 203 |
| |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
204 | 209 |
| |
205 | 210 |
| |
206 | 211 |
| |
|
0 commit comments
Comments
(0)