美文网首页
五分钟笔记-RocksDB

五分钟笔记-RocksDB

作者: 拖鞋花短裤 | 来源:发表于2018-10-25 17:55 被阅读0次

    下图罗列了当前MYSQL可选的数据引擎(后端),InnoDB作为默认的后端。业内有很多关于InnoDB,MyISAM和MyRocks(RockSDB)的比较,作为入门者,在此梳理一下有助于更好的了解对应的选型场景及背后的技术原因。

    Comparison of MySQL database engines  (摘自wiki)

    RocksDB vs InnoDB

    RocksDB优势:

    rocksdb相对于innodb提供的API层次性更好,意味着基于rockdb开发的数据后端通用性,移植性会更好,这也是spdk目前暂时仅支持rocksdb的原因之一。性能方面之前已经有过不少的相关的对比测试,如根据http://smalldatum.blogspot.com/2016/01/rocksdb-vs-innodb-via-linkbench.html的测试结果,其指出rocksdb相较于innodb压缩占用空间更少,同时针对磁盘的写次数更少,盘相应时间也更少。

    - 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劣势:

    不支持以下特性:

    - 隔离仅支持RR,RC。对应可能的问题如下表:

    Relationship of isolation level and r/w    

    - binlog与RocksDB之间没有xa,异常crash可能丢数据

    作为MySQL的默认引擎,其支持xa,savepoint,这些rocksdb是不支持

    以下列出的限制摘录于https://www.percona.com/doc/percona-server/LATEST/myrocks/limitations.html

    Online DDL

    ALTER TABLE ... EXCHANGE PARTITION

    SAVEPOINT

    Transportable tablespace

    Foreign keys

    Spatial indexes

    Fulltext indexes

    Gap locks

    Group Replication

    当前RocksDB状态

    wiki上比较清晰的梳理了当前使用rocksdb作为可选数据引擎(Alternative backend)或已内置rocksdb(Embedded)的数据库管理系统。可以看到MySQL可以用MyRocks(基于rocksdb开发)作为可选的数据引擎,Ceph的bluestore直接用了rocksdb来作为OSD节点上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

    相关文章

      网友评论

          本文标题:五分钟笔记-RocksDB

          本文链接:https://www.haomeiwen.com/subject/xqyctqtx.html