Commit 9a4b400
committed
[yugabyte#4395] Prepared/replicated operation state ordering fix with a perf workaround for 64-core nodes
Summary:
Commit f9f906a ("[yugabyte#4395] Fix SnapshotTxnTest.MultiWriteWithRestart flakiness") fixed an issue when a replicated operation could still be unprepared, and we were treating it as prepared.
But it was causing a regression in a heavy write workload (MultiTableMultiIndexInserts in yb-sample-apps) on a 3-node cluster with 64-core i3.16xlarge nodes.
So it was reverted by commit 1158e5f ("[yugabyte#4835] Revert operation driver logic changes causing a perf regression").
After an investigation it became clear that submitting an empty task to the preparer's thread pool helps avoid the performance regression.
So in this diff we are restoring the above fix with this small addition that fixes the regression.
Here is an explanation of why submitting an empty task improves performance.
We are using a ThreadPool that uses a mutex when submitting a task, and many threads are trying to submit tasks to this thread pool.
Waiting on this mutex sometimes takes a significant amount of time.
So, when we submit an empty task, it works like a small delay.
Since it is done while UpdateConsensus is being processed, it increases UpdateConsensus processing time at a follower.
As a result the leader can accumulate a bigger UpdateConsensus request for the next call that result in fewer UpdateConsensus calls overall, i.e. better batching.
This submission of an empty task to the thread pool is only acceptable as a temporary solution to the performance issue caused by the correctness fix. However, the prepared/replicated state ordering fix and performance of the MultiTableMultiIndexInserts workload on 64-core nodes are both important, so this diff implements the best solution available to us now.
A better solution for the performance issue would be to implement a controlled UpdateConsensus delay that improves throughput.
Test Plan: ybd tsan --gtest_filter SnapshotTxnTest.MultiWriteWithRestart -n 500 -- -p 2
Reviewers: mikhail
Reviewed By: mikhail
Subscribers: bogdan, ybase
Differential Revision: https://phabricator.dev.yugabyte.com/D87191 parent baa37e3 commit 9a4b400
File tree
3 files changed
+59
-60
lines changed- src/yb/tablet
- operations
3 files changed
+59
-60
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
265 | 262 | | |
266 | 263 | | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
| 264 | + | |
| 265 | + | |
274 | 266 | | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
| 267 | + | |
295 | 268 | | |
296 | 269 | | |
297 | 270 | | |
| |||
373 | 346 | | |
374 | 347 | | |
375 | 348 | | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
380 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
381 | 373 | | |
382 | 374 | | |
383 | 375 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
234 | | - | |
| 234 | + | |
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
142 | | - | |
143 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
144 | 156 | | |
145 | 157 | | |
146 | 158 | | |
| |||
213 | 225 | | |
214 | 226 | | |
215 | 227 | | |
216 | | - | |
217 | | - | |
| 228 | + | |
218 | 229 | | |
219 | | - | |
220 | | - | |
| 230 | + | |
221 | 231 | | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | | - | |
227 | | - | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
237 | 245 | | |
238 | | - | |
239 | 246 | | |
240 | 247 | | |
241 | 248 | | |
| |||
0 commit comments