UC Berkeley新发布的KV数据库Anna简评

如题所述

第1个回答  2022-06-29

要点:

需要更多细节可以阅读文末链接中的论文,下面是论文内容的一些摘录。

Coordination-free Actors

In multi-master replication, a key is replicated on multiple actors, each of which can read and update its own local copy.

In a coordination-free approach, on the other hand, each actor can process a request locally without introducing any inter-actor communication on the critical path. Updates are periodically communicated to other actors when a timer is triggered or when the actor experiences a reduction in request load.

Unlike synchronous multi-master and single-master replication, a coordination-free multi-master scheme could lead to inconsistencies between replicas, because replicas may observe and process messages in different orders.

Rader: Key通过一致性哈希分不到不同的Server和Actors

Anna perform updates against their local state in parallel without synchronizing, and periodically exchange state via multicast.

Anna employs simple eventual consistency , and threads are set to multicast every 100 milliseconds.

On single machine, Actors update their local states, then write the updates to a shared buffer and multicast the address of updates in buffer to other actors.

On different machines, updates needs to be serialized (e.g. through protobuf) and then broadcast through tcp.

Rader:Anna是 最终一致性 的,意味着会有一个时间窗口各个Actor本地的状态是不同步的

Anna indeed achieves wait-free execution: the vast majority of CPU time (90%) is spent processing requests without many cache misses, while overheads of lattice merge and multicast are small. In short, Anna’s Coordination-free actor model addresses the heart of the scalability limitations of multi-core KVS systems.

TBB and Masstree spend 92% - 95% of the CPU time on atomic instructions under high contention, and only 4% - 7% of the CPU time is devoted to request handling. As a result, the TBB hash map and Masstree perform 50× slower than Anna (rep= 1) and 700× slower than Anna (full replication).

Rader:更新冲突较多的情况下,共享内存模型花费了绝大多数的CPU在原子操作上,不管是有锁还是无锁的实现方式维护“ 缓存一致性 ”都是瓶颈。 Redis因为是单线程的,没有这方面的问题。

for systems that support multi-master replication, having a high replication factor under low contention workloads can hurt performance. Instead, we want to dynamically monitor the data’s contention level and
selectively replicate the highly contented keys across threads

Rader:冲突较少的情况下,谨慎选择副本数量,过多的副本会伤害性能

Anna can significantly outperform Redis Cluster by replicating hot keys under high contention, and can
match the performance of Redis Cluster under low contention.

Rader:低冲突的情况下跟Redis性能差不多,但是高冲突的时候可以通过Hot Key副本提高性能

相似回答