RocksDB statistics

Nebula Graph uses RocksDB as its underlying storage. The purpose of this document is to teach you how to collect and display the RocksDB statistics for Nebula Graph.

Enabling the RocksDB statistics

The RocksDB Statistics function is disabled by default. If you want to enable the RocksDB statistics function, you need to:

  • modify the --enable_rocksdb_statistics parameter to true in the storage configuration file storaged.conf. The default configuration file directory is /home/user/nebula/build/install/etc.
  • restart the services to make the modifications take effect.

When the function is enabled, the statistics is dumped to the log file of each DB service regularly.

Getting the RocksDB statistics

You can use the built-in web interface in the storage service to get the statistics. There are three methods to get the RocksDB statistics by using the web service:

  1. Get all the statistics.
  2. Get information for a specified entry.
  3. Support returning the Json format result.

Examples

Get all the RocksDB statistics by using the following command:

curl -L "http://${storage_ip}:${port}/rocksdb_stats"

For example:

curl -L "http://172.28.2.1:12000/rocksdb_stats"

rocksdb.blobdb.blob.file.bytes.read=0
rocksdb.blobdb.blob.file.bytes.written=0
rocksdb.blobdb.blob.file.bytes.synced=0
...

Get part of the RocksDB statistics by using the following command:

curl -L "http://${storage_ip}:${port}/rocksdb_stats?stats=${stats_name}"

For example:

curl -L "http://172.28.2.1:12000/rocksdb_stats?stats=rocksdb.bytes.read,rocksdb.block.cache.add"

rocksdb.block.cache.add=14
rocksdb.bytes.read=1632

Get part of the RocksDB statistics in JSON format by using the following command:

curl -L "http://${storage_ip}:${port}/rocksdb_stats?stats=${stats_name}.&returnjson"

For example:

curl -L "http://172.28.2.1:12000/rocksdb_stats?stats=rocksdb.bytes.read,rocksdb.block.cache.add&returnjson"

[{"value":14,"name":rocksdb.block.cache.add},{"value":1632,"name":"rocksdb.bytes.read"}]