Skip to content

Bound DashMap shard counts for per-reader caches - #10485

Merged
robert3005 merged 1 commit into
developfrom
rk/dashmap-bounded-shards
Oct 14, 2026
Merged

robert3005 merged 1 commit into
developfrom
rk/dashmap-bounded-shards

Conversation

@robert3005

Copy link
Copy Markdown
Contributor

Bound number of shards created in DashMaps to avoid explosion of shards under
high core counts

@codspeed

codspeed Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 10.57%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ 11 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 2 regressed benchmarks
✅ 2217 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ WallTime bitpack_blocked_compress_avx2 6.7 µs 7.5 µs -10.61%
❌ WallTime threshold_avx512[8] 1.8 µs 2 µs -10.53%

Tip

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


Comparing rk/dashmap-bounded-shards (d68ea53) with develop (7319276)

Open in CodSpeed

@joseph-isaacs joseph-isaacs added the changelog/performance A performance improvement label Oct 14, 2026
Comment thread vortex-duckdb/src/exporter/cache.rs Resolved
@robert3005
robert3005 force-pushed the rk/dashmap-bounded-shards branch from 8553457 to bbb14a5 Compare October 14, 2026 12:54
@robert3005
robert3005 enabled auto-merge (squash) October 14, 2026 13:19
`DashMap::default()` creates four shards per available thread. Each shard
is a cache-padded lock and a table, so on a 192-core machine every map has
1024 shards. Layout readers create such maps per reader (for example one
`DictReader` per dict chunk), so opening and dropping a file built and
freed tens of thousands of shard tables. In DuckDB a file reader is
dropped while the global multi-file scan lock is held, so this cost
blocked every scan thread.

Create the maps that exist per reader or per file with a fixed shard
count:

- 8 shards for per-reader caches in the dict, struct, zoned, row-index
  and file-stats readers.
- 64 shards for per-file maps that all scan threads use: the in-flight
  map of `SharedSegmentSource` and the DuckDB `ConversionCache`.

Measured on a c8g.metal-48xl together with dropping DuckDB file scan
state outside the multi-file lock and a pooled buffer allocator:
ClickBench q20 at 192 threads went from 172 ms to 92 ms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019VbXEWQzqmW5Sxb73DN1Zx
Signed-off-by: Robert Kruszewski <github@robertk.io>
Comment thread vortex-duckdb/src/exporter/cache.rs Resolved
@robert3005
robert3005 merged commit f29fdb4 into develop Oct 14, 2026
91 of 93 checks passed
@robert3005
robert3005 deleted the rk/dashmap-bounded-shards branch October 14, 2026 13:41
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