Repository navigation
Bound DashMap shard counts for per-reader caches - #10485
Conversation
Merging this PR will degrade performance by 10.57%
|
| 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)
8553457 to
bbb14a5
Compare
`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>
bbb14a5 to
d68ea53
Compare
Bound number of shards created in DashMaps to avoid explosion of shards under
high core counts