cockroachdb / cockroachdb/pebble
db: read performance degradation when sharding a Pebble DB
- Dominant language
- Go
- Stars
- 6k
- Forks
- 584
- Avg merge
- 16h 35m
- Merged PRs (30d)
- 5
Description
To improve scalability, we sharded a single Pebble DB (~600 GB) into multiple instances (initially 8 shards).
Total block cache and handles are evenly split across the 8 DB instances (i.e., each shard gets 1/6 of the cache and handle budget). Each instance uses a separate cache.
Workload (blockchain system): predominantly serial/low-concurrency reads ,write batch.
However, during system read/write operations, The multi-shard version shows worse read performance compared to the single DB version.
1)Read latency is about 10% worse in the multi-shard setup.
2) By checking Pebble’s built-in block cache metrics: The overall block cache hit rate in the multi-shard setup is about 91.4%. In contrast, the single DB setup achieves about 93.2% hit rate.
We suspect cache locality/fragmentation is the main culprit. We tried creating one shared pebble.Cache instance and passing it into all shard DBs (8-shard test), but the results still didn’t improve meaningfully
**Quesions:**
1. What tuning approaches or design patterns are recommended to make multi-DB/sharded Pebble perform well?
2. Is there guidance on effective cache sharing (config, sizing, admission/eviction) across DBs?
3. Are there known gotchas when sharing a cache (e.g., fairness, contention, memory accounting) that we should watch out for?
Jira issue: PEBBLE-1154
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.