下圖羅列了當(dāng)前MYSQL可選的數(shù)據(jù)引擎(后端),InnoDB作為默認(rèn)的后端仙辟。業(yè)內(nèi)有很多關(guān)于InnoDB境蜕,MyISAM和MyRocks(RockSDB)的比較撑教,作為入門者叹话,在此梳理一下有助于更好的了解對(duì)應(yīng)的選型場(chǎng)景及背后的技術(shù)原因偷遗。
RocksDB vs InnoDB
RocksDB優(yōu)勢(shì):
rocksdb相對(duì)于innodb提供的API層次性更好,意味著基于rockdb開發(fā)的數(shù)據(jù)后端通用性驼壶,移植性會(huì)更好氏豌,這也是spdk目前暫時(shí)僅支持rocksdb的原因之一。性能方面之前已經(jīng)有過不少的相關(guān)的對(duì)比測(cè)試热凹,如根據(jù)http://smalldatum.blogspot.com/2016/01/rocksdb-vs-innodb-via-linkbench.html的測(cè)試結(jié)果泵喘,其指出rocksdb相較于innodb壓縮占用空間更少,同時(shí)針對(duì)磁盤的寫次數(shù)更少般妙,盤相應(yīng)時(shí)間也更少纪铺。
- Uncompressed InnoDB loads faster than MyRocks and MyRocks loads faster than compressed InnoDB. I hope to figure out how to make MyRocks load faster than uncompressed InnoDB.
- MyRocks uses about half the disk space compared to compressed InnoDB.
- MyRocks writes much less to storage than InnoDB. This allows a workload to run on low-endurance SSD with MyRocks when it requires high-endurance SSD with InnoDB.
- Average and p99 response times are much better for MyRocks
- Maximum response times were usually better for InnoDB
RocksDB劣勢(shì):
不支持以下特性:
- 隔離僅支持RR,RC碟渺。對(duì)應(yīng)可能的問題如下表:
- binlog與RocksDB之間沒有xa鲜锚,異常crash可能丟數(shù)據(jù)
以下列出的限制摘錄于https://www.percona.com/doc/percona-server/LATEST/myrocks/limitations.html
ALTER TABLE ... EXCHANGE PARTITION
當(dāng)前RocksDB狀態(tài)
wiki上比較清晰的梳理了當(dāng)前使用rocksdb作為可選數(shù)據(jù)引擎(Alternative backend)或已內(nèi)置rocksdb(Embedded)的數(shù)據(jù)庫(kù)管理系統(tǒng)∪藜可以看到MySQL可以用MyRocks(基于rocksdb開發(fā))作為可選的數(shù)據(jù)引擎浆洗,Ceph的bluestore直接用了rocksdb來(lái)作為OSD節(jié)點(diǎn)上metadata的管理。
Alternative backend
The following projects have been started to replace or offer an alternative storage engines for already-established database systems with RocksDB:
MongoDB
The MongoRocks project provides a storage module for?MongoDB?where the storage engine is RocksDB.
A related program is Rocks Strata, a tool written in?Go, which allows managing incremental backups of MongoDB when RocksDB is used as the storage engine.
MySQL
The MyRocks project creates a new RocksDB based storage engine for?MySQL.In-depth details about MyRocks were presented at Percona Live 2016.
Cassandra
Cassandra on RocksDB can improve the performance of Apache Cassandra significantly (3-4 times faster in general, 100 times faster in some use-cases."Cassandra on RocksDB at Percona Live 2018".) The Instagram team at Facebook developed and open-sourced their code, along with benchmarks of their performance results."Open-sourcing a 10x reduction in Apache Cassandra tail latency".
Embedded
The following database systems and applications have chosen to use RocksDB as their embedded storage engine:
ArangoDB
ArangoDB?has replaced its previous storage engine ("mmfiles") with RocksDB
Ceph's BlueStore
The?Ceph's?BlueStore storage layer uses RocksDB for metadata management in OSD devices
LogDevice LogsDB
LogDevice's LogsDB is built atop RocksDB
Faktory
Facktory?the background job system uses RocksDB for storage
SSDB
The ssdb-rocks?project uses RocksDB as the storage engine for the SSDB?NoSQL Database.
TiDB
The TiDB project uses RocksDB as its storage engine
參考的鏈接:
https://dev.mysql.com/doc/refman/8.0/en/innodb-introduction.html
http://smalldatum.blogspot.com/2016/01/rocksdb-vs-innodb-via-linkbench.html
https://www.percona.com/blog/2018/02/01/myrocks-engine-things-know-start/
https://www.percona.com/doc/percona-server/LATEST/myrocks/limitations.html