apache / apache/fluss

[KV] Add Configuration Option to Control RocksDB Statistics Collection

Open
#2,435 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.1k
Forks
625
Avg merge
3d 14h
Merged PRs (30d)
97

Description

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/fluss/issues) and found nothing similar.

### Motivation

RocksDB statistics collection has performance overhead. Users should be able to disable it when:
- RocksDB-level metrics are not needed
- Running in resource-constrained environments
- Troubleshooting performance issues

### Solution

**New Configuration**

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `kv.rocksdb.statistics.enabled` | Boolean | false | Enable RocksDB statistics collection for metrics |

**Files Modified**
- `ConfigOptions.java` - Add new config option
- `KvTablet.java` - Read config to control statistics initialization
- `RocksDBStatistics.java` - Minor optimization: use `getLongProperty()` instead of `getProperty()` to reduce JNI memory overhead
- `configuration.md` - Documentation

### Anything else?

Additional Optimization:

Replaced `RocksDB.getProperty()` with `getLongProperty()` in statistics collection to avoid unnecessary string allocation in JNI layer during high-frequency Prometheus scraping.

### Willingness to contribute

- [x] I'm willing to submit a PR!

Contributor guide

No contributing guide indexed for this repository

Research direction

Read ConfigOptions.java, KvTablet.java, and RocksDBStatistics.java to trace the existing statistics setup and property collection, then review configuration.md for documentation conventions. The work is done when the new option controls statistics collection, the statistics property access uses the requested optimization, and the configuration is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases, observability
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.