Skip to content

Reduce SequenceId universe lock contention - #10867

Merged
robert3005 merged 1 commit into
developfrom
rk/sequence-id-contention
Oct 27, 2026
Merged

robert3005 merged 1 commit into
developfrom
rk/sequence-id-contention

Conversation

@robert3005

@robert3005 robert3005 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Split out of #10856.

  • Allocate and free keys outside the lock.
  • Skip the waker lookup when no waker is registered. Most sequences never collapse, so usually no waker waits.
  • In descend, replace the parent with its child under one lock acquisition, instead of one to add the child and one to remove the parent.

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>
@codspeed

codspeed Bot commented Oct 27, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 23.15%

3 warnings

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ 2 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ Base and head ran on different runner types

Some benchmarks with significant performance changes were compared across different runner types, so the changes might not come from the code. Run base and head on the same runner type, or use CodSpeed Macro Runners for more stable results.

Learn more about Macro Runners

Open the report in CodSpeed to investigate

❌ 5 regressed benchmarks
✅ 2199 untouched benchmarks
⏩ 370 skipped benchmarks1
🗄️ 30 archived benchmarks run2

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Walltime filter_neon[64] 1.8 µs 2.6 µs -31.51%
❌ Walltime threshold_neon[80] 3.4 µs 4.6 µs -25.39%
❌ Walltime threshold_neon[64] 2.6 µs 3.3 µs -22.85%
❌ Walltime filter_neon[80] 2.6 µs 3.1 µs -17.62%
❌ CPU Simulation test_repeated_scan_scalar_at[int_str_float] 415.6 µs 503.6 µs -17.48%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing rk/sequence-id-contention (a7aef82) with develop (f024b10)

Open in CodSpeed

Footnotes

  1. 370 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

  2. 30 benchmarks were run, but are now archived. If they were deleted in another branch, consider rebasing to remove them from the report. Instead if they were added back, click here to restore them. ↩

robert3005 added a commit that referenced this pull request Oct 27, 2026
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>
@robert3005
robert3005 merged commit bdae6a7 into develop Oct 27, 2026
111 of 113 checks passed
@robert3005
robert3005 deleted the rk/sequence-id-contention branch October 27, 2026 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants