日期:2014-05-16  浏览次数:20507 次

RethinkDB介绍

无意中看到redis作者在博客中推荐了RethinkDB,早上来简单了解了下,记录下:

RethinkDB是一个完全支持Memcached协议、数据可持久化的工业级key-value存储系统。

RethinkDB官网介绍如下:

RethinkDB is built to store JSON documents, and scale to multiple machines with very little effort. It has a pleasant query language that supports really useful queries like table joins and group by, and is easy to setup and learn

Simple programming model:

  • JSON data model and immediate consistency.
  • Distributed joins, subqueries, aggregation, atomic updates.
  • Hadoop-style map/reduce.

Easy administration:

  • Friendly web and command-line administration tools.
  • Takes care of machine failures and network interrupts.
  • Multi-datacenter replication and failover.

Horizontal scalability:

  • Sharding and replication to multiple nodes.
  • Queries are automatically parallelized and distributed.
  • Lock-free operation via MVCC concurrency.
以上为官网的简单介绍,官网也有详细的测试。

在网上查了下一些资料,摘要如下:

RethinkDB的特点:
- 随CPU个数线程扩展
- SSD上速度快十倍
- 节省内存空间
- 断电后及时恢复  
- 细化的持久性控制
- 支持上万的并发连接数
- 支持裸盘设备,多磁盘上自动数据分区 

RethinkDB的设计思想
1.B树会产生大量的随机写操作,对闪存寿命的负面影响很大。
2.闪存具有良好的随机读性能,所以B树和cluster index变得不再重要。
3.基于以上判断,RethinkDB采用append-only的方式来管理数据和索引,消除闪存上的随机写操作

Append-Only的影响
优点:

1.数据一致性(Data Consistency)。
- 所有更新追加到文件尾部,其他部分没有任何修改
- 文件的其余部分提供了一个完全一致的数据库
2.热备份(Hot Backups)。
- 在数据库文件被修改的同时可以拷贝一致数据
- 可简单地实现增量备份
3.及时恢复(Instantaneous Recovery)
- 数据库本身就类似于一个事务日志
- 恢复时直接截断数据库文件到一个已知一致的事务
缺点:<