Skip to content

[Enhancement] Make Pop RocksDB BlockCache size configurable via MessageStoreConfig #10270

@lizhimins

Description

@lizhimins

Before Creating the Enhancement Request

  • I have confirmed that this should be classified as an enhancement rather than a bug/feature.

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

  1. Add popRocksdbBlockCacheSize (default 256MB) to MessageStoreConfig as a configurable property.
  2. Update RocksDBOptionsFactory.createPopCFOptions(long blockCacheSize) to accept the cache size as a parameter.
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions