Before Creating the Enhancement Request
Summary
Make the Pop Consumer RocksDB BlockCache size configurable through MessageStoreConfig instead of being hardcoded, allowing operators to tune it based on their deployment's memory budget.
Motivation
The Pop Consumer RocksDB store (PopConsumerRocksdbStore) creates two ColumnFamilies (default and popState), each with its own independent BlockCache. Previously, the BlockCache was hardcoded at 1024MB per ColumnFamily in RocksDBOptionsFactory.createPopCFOptions(), consuming ~2GB of memory even though the Pop workload primarily performs sequential reads where OS PageCache handles data block caching effectively.
For containers with limited memory budgets (e.g., 8GB pods with 4GB JVM heap), this hardcoded allocation leaves insufficient room for RocketMQ's PageCache requirements (CommitLog MappedFile, ConsumeQueue, etc.) and JVM off-heap overhead.
Describe the Solution You'd Like
- Add
popRocksdbBlockCacheSize (default 256MB) to MessageStoreConfig as a configurable property.
- Update
RocksDBOptionsFactory.createPopCFOptions(long blockCacheSize) to accept the cache size as a parameter.
PopConsumerRocksdbStore reads the value from MessageStoreConfig during initialization.
Describe Alternatives You've Considered
- Disabling BlockCache entirely: RocksDB requires a non-null block cache, so this is not possible.
- Hardcoding a smaller value (e.g., 16MB): This would not allow operators to adjust based on their specific workload or memory capacity.
- Using BrokerConfig instead:
MessageStoreConfig is the existing home for RocksDB-related configuration and is already passed to the Pop Consumer initialization chain.
Additional Context
The change touches the following files:
store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.java
store/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.java
broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerRocksdbStore.java
broker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java
Before Creating the Enhancement Request
Summary
Make the Pop Consumer RocksDB BlockCache size configurable through
MessageStoreConfiginstead of being hardcoded, allowing operators to tune it based on their deployment's memory budget.Motivation
The Pop Consumer RocksDB store (
PopConsumerRocksdbStore) creates two ColumnFamilies (default and popState), each with its own independent BlockCache. Previously, the BlockCache was hardcoded at 1024MB per ColumnFamily inRocksDBOptionsFactory.createPopCFOptions(), consuming ~2GB of memory even though the Pop workload primarily performs sequential reads where OS PageCache handles data block caching effectively.For containers with limited memory budgets (e.g., 8GB pods with 4GB JVM heap), this hardcoded allocation leaves insufficient room for RocketMQ's PageCache requirements (CommitLog MappedFile, ConsumeQueue, etc.) and JVM off-heap overhead.
Describe the Solution You'd Like
popRocksdbBlockCacheSize(default 256MB) toMessageStoreConfigas a configurable property.RocksDBOptionsFactory.createPopCFOptions(long blockCacheSize)to accept the cache size as a parameter.PopConsumerRocksdbStorereads the value fromMessageStoreConfigduring initialization.Describe Alternatives You've Considered
MessageStoreConfigis the existing home for RocksDB-related configuration and is already passed to the Pop Consumer initialization chain.Additional Context
The change touches the following files:
store/src/main/java/org/apache/rocketmq/store/config/MessageStoreConfig.javastore/src/main/java/org/apache/rocketmq/store/rocksdb/RocksDBOptionsFactory.javabroker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerRocksdbStore.javabroker/src/main/java/org/apache/rocketmq/broker/pop/PopConsumerService.java