RocksDB statistics¶
NebulaGraph uses RocksDB as the underlying storage. This topic describes how to collect and show the RocksDB statistics of NebulaGraph.
Enable RocksDB¶
By default, the function of RocksDB statistics is disabled. To enable RocksDB statistics, you need to:
-
Modify the
--enable_rocksdb_statisticsparameter astruein thenebula-storaged.conffile. The default path of the configuration file is/use/local/nebula/etc. -
Restart the service to make the modification valid.
Get RocksDB statistics¶
Users can use the built-in HTTP service in the storage service to get the following types of statistics. Results in the JSON format are supported.
- All RocksDB statistics.
- Specified RocksDB statistics.
Examples¶
Use the following command to get all RocksDB statistics:
bash
curl -L "http://${storage_ip}:${port}/rocksdb_stats"
For example: ``` curl -L "http://172.28.2.1:19779/rocksdb_stats"
rocksdb.blobdb.blob.file.bytes.read=0 rocksdb.blobdb.blob.file.bytes.written=0 rocksdb.blobdb.blob.file.bytes.synced=0 ... ```
Use the following command to get specified RocksDB statistics:
bash
curl -L "http://${storage_ip}:${port}/rocksdb_stats?stats=${stats_name}"
For example, use the following command to get the information of rocksdb.bytes.read and rocksdb.block.cache.add.
```bash
curl -L "http://172.28.2.1:19779/rocksdb_stats?stats=rocksdb.bytes.read,rocksdb.block.cache.add"
rocksdb.block.cache.add=14 rocksdb.bytes.read=1632 ```
Use the following command to get specified RocksDB statistics in the JSON format:
bash
curl -L "http://${storage_ip}:${port}/rocksdb_stats?stats=${stats_name}&format=json"
For example, use the following command to get the information of rocksdb.bytes.read and rocksdb.block.cache.add and return the results in the JSON format.
```bash
curl -L "http://172.28.2.1:19779/rocksdb_stats?stats=rocksdb.bytes.read,rocksdb.block.cache.add&format=json"
[ { "rocksdb.block.cache.add": 1 }, { "rocksdb.bytes.read": 160 } ] ```