Repository navigation
Reduce SequenceId universe lock contention - #10867
Conversation
Every writer task contends on the SequenceId universe lock. Shorten its critical sections: allocate and free keys outside the lock, skip the waker lookup when no waker is registered, and replace the parent with its child under one lock acquisition in `descend`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Robert Kruszewski <github@robertk.io>
Merging this PR will degrade performance by 23.15%3 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Profiling the compress benchmark showed that file statistics, not compression, took most of the Vortex write time: - **File stats ran serially.** `accumulate_stats` ran every column's aggregates in one `stream.scan`, in front of the parallel compressors. On CMSprovider, this alone was about as long as the full write. - **Min/max ran twice.** `Max`/`Min` and `BoundedMax`/`BoundedMin` each ran their own `min_max` scan. String chunks were also converted from VarBin to VarBinView twice. - **Unsupported aggregates built errors.** `StatsAccumulator::new` called `accumulator()` and threw the error away for each unsupported aggregate (for example `NanCount` on non-floats). Each error captures a backtrace. On a table with 10k columns, this took ~200 ms per write, and the CI benchmarks set `RUST_BACKTRACE=full`. ## Results These numbers also include the `SequenceId` lock contention fix, which is now in #10867. Compress time, min of 3 iterations, 16 threads, Apple Silicon: | Dataset | Parquet (ms) | Vortex before (ms) | Vortex after (ms) | Speedup | |---|---:|---:|---:|---:| | taxi | 147 | 254 | 152 | 1.67× | | Arade | 482 | 520 | 311 | 1.67× | | Bimbo | 1625 | 2263 | 1816 | 1.25× | | CMSprovider | 708 | 1995 | 723 | 2.76× | | Euro2016 | 397 | 210 | 156 | 1.34× | | Food | 212 | 190 | 129 | 1.47× | | HashTags | 214 | 401 | 319 | 1.26× | | TPC-H l_comment chunked | 758 | 611 | 323 | 1.89× | | TPC-H l_comment canonical | 759 | 607 | 332 | 1.83× | | wide cols=10000 chunks=1 | 206 | 492 | 246 | 2.00× | | wide cols=10000 chunks=50 | 219 | 457 | 249 | 1.84× | --------- Signed-off-by: Robert Kruszewski <github@robertk.io>
Split out of #10856.
descend, replace the parent with its child under one lock acquisition, instead of one to add the child and one to remove the parent.