SHOW ENGINE ROCKSDB状态提供有关MyRocks下的RocksDB引擎的有用诊断和调试信息。
mysql> show engine rocksdb status\G
*************************** 1. row ***************************
Type: DBSTATS
Name: rocksdb
Status:
** DB Stats **
Uptime(secs): 89725.6 total, 36.8 interval
Cumulative writes: 8 writes, 11 keys, 8 commit groups, 0.9 writes per commit group, ingest: 0.00 GB, 0.00 MB/s
Cumulative WAL: 8 writes, 3 syncs, 2.00 writes per sync, written: 0.00 GB, 0.00 MB/s
Cumulative stall: 00:00:0.000 H:M:S, 0.0 percent
Interval writes: 3 writes, 4 keys, 3 commit groups, 0.8 writes per commit group, ingest: 0.00 MB, 0.00 MB/s
Interval WAL: 3 writes, 0 syncs, 3.00 writes per sync, written: 0.00 MB, 0.00 MB/s
Interval stall: 00:00:0.000 H:M:S, 0.0 percent
** Level 0 read latency histogram (micros):
Count: 5 Average: 2.2000 StdDev: 2.32
Min: 0 Median: 0.8333 Max: 5
Percentiles: P50: 0.83 P75: 4.38 P99: 4.97 P99.9: 5.00 P99.99: 5.00
------------------------------------------------------
[ 0, 1 ) 3 60.000% 60.000% ############
[ 4, 5 ) 2 40.000% 100.000% ########
*************************** 2. row ***************************
Type: CF_COMPACTION
Name: __system__
Status:
** Compaction Stats [__system__] **
Level Files Size(MB} Score Read(GB} Rn(GB} Rnp1(GB} Write(GB} Wnew(GB} Moved(GB} W-Amp Rd(MB/s} Wr(MB/s} Comp(sec} Comp(cnt} Avg(sec} KeyIn KeyDrop
----------------------------------------------------------------------------------------------------------------------------------------------------------
L0 2/0 0.00 0.5 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.6 0 1 0.002 0 0
Sum 2/0 0.00 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.6 0 1 0.002 0 0
Int 0/0 0.00 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.6 0 1 0.002 0 0
Uptime(secs): 89725.6 total, 89725.6 interval
Flush(GB): cumulative 0.000, interval 0.000
AddFile(GB): cumulative 0.000, interval 0.000
AddFile(Total Files): cumulative 0, interval 0
AddFile(L0 Files): cumulative 0, interval 0
AddFile(Keys): cumulative 0, interval 0
Cumulative compaction: 0.00 GB write, 0.00 MB/s write, 0.00 GB read, 0.00 MB/s read, 0.0 seconds
Interval compaction: 0.00 GB write, 0.00 MB/s write, 0.00 GB read, 0.00 MB/s read, 0.0 seconds
Stalls(count): 0 level0_slowdown, 0 level0_slowdown_with_compaction, 0 level0_numfiles, 0 level0_numfiles_with_compaction, 0 stop for pending_compaction_bytes, 0 slowdown for pending_compaction_bytes, 0 memtable_compaction, 0 memtable_slowdown, interval 0 total count
*************************** 3. row ***************************
Type: CF_COMPACTION
Name: default
Status:
** Compaction Stats [default] **
Level Files Size(MB} Score Read(GB} Rn(GB} Rnp1(GB} Write(GB} Wnew(GB} Moved(GB} W-Amp Rd(MB/s} Wr(MB/s} Comp(sec} Comp(cnt} Avg(sec} KeyIn KeyDrop
----------------------------------------------------------------------------------------------------------------------------------------------------------
L0 1/0 0.00 0.2 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.4 0 1 0.003 0 0
Sum 1/0 0.00 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.4 0 1 0.003 0 0
Int 0/0 0.00 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.4 0 1 0.003 0 0
Uptime(secs): 89725.6 total, 89725.6 interval
Flush(GB): cumulative 0.000, interval 0.000
AddFile(GB): cumulative 0.000, interval 0.000
AddFile(Total Files): cumulative 0, interval 0
AddFile(L0 Files): cumulative 0, interval 0
AddFile(Keys): cumulative 0, interval 0
Cumulative compaction: 0.00 GB write, 0.00 MB/s write, 0.00 GB read, 0.00 MB/s read, 0.0 seconds
Interval compaction: 0.00 GB write, 0.00 MB/s write, 0.00 GB read, 0.00 MB/s read, 0.0 seconds
Stalls(count): 0 level0_slowdown, 0 level0_slowdown_with_compaction, 0 level0_numfiles, 0 level0_numfiles_with_compaction, 0 stop for pending_compaction_bytes, 0 slowdown for pending_compaction_bytes, 0 memtable_compaction, 0 memtable_slowdown, interval 0 total count
*************************** 4. row ***************************
Type: Memory_Stats
Name: rocksdb
Status:
MemTable Total: 3768
MemTable Unflushed: 1712
Table Readers Total: 0
Cache Total: 450
Default Cache Capacity: 0
4 rows in set (0.00 sec)
RocksDB引擎状态有5个不同的部分。
本节提供有关数据库的整体统计信息。大多数字段都是自解释的,但在此处列出:
* Uptime - 以秒为单位,表示系统启动的总时间。
* 间隔是指上次统计信息收集期的长度
* Write Status - 报告写入批次总数,这些批次中的keys键总数,写入大小和写入吞吐量
* WAL - 在PUT上,记录也将写入Write Ahead Log。还会报告对WAL的写入总数,吞吐量以及发生的 fsync / fdatasync数
* Keys - RocksDB引擎中的keys键总数。
* Ingest - 获取的总数据和获取速率,以每秒MBytes为单位。
* WAL的每个同步的平均写入次数(这可以大致了解崩溃时可能丢失的写入次数)。
还有关于发动机中遇到的档位的信息。上述统计数据按累计和间隔报告。
本节列出了RocksDB(Log Structured Merge Tree)中不同等级别LSM遇到的读取延迟。
典型的延迟可以在低微秒内,因为 keys键可以在memtable和块缓存中找到,但是如果存在缓存未命中
或者在较低级中找到key键,则延迟会添加。这是因为需要读取更多数量的SST文件,并且需要进行更多的二进制搜索。
每个列族都有一组统计信息,包括系统列族。有关LSM和列族的更多信息,请参阅RocksDB wiki维基百科。
第一小节列出了列族的每个级别的文件的数量和大小
Rn(GB) - 指非输出级别的总读数
Rnp1(GB) - 指输出级别的读取量。跟随分级输出,是该列族的一般压缩统计。
* MemTable 未刷新 - 尚未刷新到SST文件的memtable的大小
* Cache 缓存总计 - 块缓存大小
SHOW ENGINE ROCKSDB TRANSACTION STATUS提供与快照和事务死锁相关的有用诊断和调试信息。
mysql> show engine rocksdb transaction status\G
*************************** 1. row ***************************
Type: rocksdb
Name:
Status:
============================================================
2017-09-25 14:19:20 ROCKSDB TRANSACTION MONITOR OUTPUT
============================================================
---------
SNAPSHOTS
---------
LIST OF SNAPSHOTS FOR EACH SESSION:
---SNAPSHOT, ACTIVE 40 sec
MySQL thread id 17, OS thread handle 0x7fb344ed2700, query id 54 localhost root
lock count 4, write count 2
insert count 2, update count 0, delete count 0
----------LATEST DETECTED DEADLOCKS----------
*** DEADLOCK PATH
=========================================
TRANSACTIONID: 11
COLUMN FAMILY NAME: default
WAITING KEY: 0000010480000002
LOCK TYPE: EXCLUSIVE
INDEX NAME: PRIMARY
TABLE NAME: test.t
---------------WAITING FOR---------------
TRANSACTIONID: 12
COLUMN FAMILY NAME: default
WAITING KEY: 0000010480000001
LOCK TYPE: EXCLUSIVE
INDEX NAME: PRIMARY
TABLE NAME: test.t
---------------WAITING FOR---------------
TRANSACTIONID: 11
COLUMN FAMILY NAME: default
WAITING KEY: 0000010480000002
LOCK TYPE: EXCLUSIVE
INDEX NAME: PRIMARY
TABLE NAME: test.t
--------TRANSACTIONID: 12 GOT DEADLOCK---------
-----------------------------------------
END OF ROCKSDB TRANSACTION MONITOR OUTPUT
=========================================
1 row in set (0.00 sec)
显示打开的当前活动快照列表。包括以下信息:
* Thread ID 线程ID
* OS handle OS系统句柄
* Query ID 查询ID
* Host 主机
* User 用户
* Lock count 锁数量
* Write count 写数量
* Insert count 插入数量
* Update count 更新数量
* Delete count 删除数量
显示有关为最新监测到的死锁形成的死锁循环信息,并包括循环中每个节点的一下信息:
* Transaction ID 事务ID
* Column Family Name 列族名
* Waiting Key 锁等待
* Lock Type 锁类型
* Index Name 索引名
* Table Name 表名