Repository navigation
[FLUSS] Support shared RocksDB block cache across KV tablets - #2627
Merged
Merged
Conversation
platinumhamburg
force-pushed
the
shared-block-cache
branch
2 times, most recently
from
July 21, 2026 03:17
ad2ebda to
c849677
Compare
platinumhamburg
force-pushed
the
shared-block-cache
branch
from
September 1, 2026 02:56
c849677 to
d876754
Compare
Introduce a TabletServer-level shared LRUCache for KV tablets, controlled by kv.rocksdb.shared-block-cache.size. A value of zero keeps the existing per-tablet caches, while a positive value enables one shared cache with that soft capacity. Manage the cache lifecycle in KvManager, avoid double-counting shared cache memory in table metrics, expose server-level usage, pinned usage, and capacity metrics, and document the configuration and observability semantics.
platinumhamburg
force-pushed
the
shared-block-cache
branch
from
September 1, 2026 03:36
d876754 to
6230daf
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds an optional TabletServer-scoped shared RocksDB LRUCache to be used as the block cache across all KV tablets, aiming to better control/optimize memory usage as table count grows (Issue #1319). It also updates metrics aggregation to avoid double-counting when a cache is shared, and documents the new behavior.
Changes:
- Introduce a TabletServer-level shared RocksDB block cache created/owned by
KvManagerand passed down intoKvTablet/RocksDBResourceContainerwhen enabled via config. - Extend server-level metrics to report shared block cache usage/capacity/pinned usage once, and adjust total memory aggregation accordingly.
- Add/extend tests and documentation for the shared-cache configuration and the updated metrics semantics.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| website/docs/maintenance/observability/monitor-metrics.md | Document new server-level shared block cache metrics and clarify total-memory aggregation semantics. |
| website/docs/maintenance/configuration.md | Document kv.rocksdb.shared-block-cache.size and clarify interaction with per-instance kv.rocksdb.block.cache-size. |
| fluss-server/src/test/java/org/apache/fluss/server/metrics/group/TabletServerMetricGroupTest.java | Add unit test ensuring server total memory counts shared cache once and shared-cache metrics are exposed. |
| fluss-server/src/test/java/org/apache/fluss/server/kv/rocksdb/RocksDBResourceContainerTest.java | Add tests for shared cache wiring/lifecycle and independent cache closure behavior. |
| fluss-server/src/test/java/org/apache/fluss/server/kv/KvTabletTest.java | Update test construction signature and strengthen RocksDB memory-metric consistency assertions. |
| fluss-server/src/test/java/org/apache/fluss/server/kv/KvManagerTest.java | Add test verifying shared cache is used across multiple KV tablets when configured. |
| fluss-server/src/main/java/org/apache/fluss/server/metrics/group/TabletServerMetricGroup.java | Add shared-cache gauges and incorporate shared cache usage into server total memory metric. |
| fluss-server/src/main/java/org/apache/fluss/server/kv/rocksdb/RocksDBStatistics.java | Avoid double-counting in total memory calculation and clarify semantics when cache is shared/not attributable. |
| fluss-server/src/main/java/org/apache/fluss/server/kv/rocksdb/RocksDBResourceContainer.java | Accept optional external/shared cache and avoid closing it from per-tablet containers. |
| fluss-server/src/main/java/org/apache/fluss/server/kv/KvTablet.java | Thread shared cache into RocksDB construction and omit cache from per-tablet RocksDBStatistics when shared. |
| fluss-server/src/main/java/org/apache/fluss/server/kv/KvManager.java | Create/own shared cache lifecycle, wire it into tablets, and register shared-cache metric suppliers. |
| fluss-common/src/main/java/org/apache/fluss/metrics/MetricNames.java | Add metric name constants for shared block cache usage/capacity/pinned usage. |
| fluss-common/src/main/java/org/apache/fluss/config/ConfigOptions.java | Add kv.rocksdb.shared-block-cache.size config option and clarify kv.rocksdb.block.cache-size behavior with shared cache. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce a TabletServer-level shared LRUCache for all KV tablets, controlled by kv.rocksdb.shared-block-cache.size.
Purpose
Linked issue: close #1319
Brief change log
Tests
API and Format
Documentation