徐老师好,学完Megastore我还是没想明白为什么它的写入吞吐量只有每秒几次。论文第2.2.3节Physical Layout提到,为了降低延迟,提高吞吐量,Megastore允许应用把数据放在靠近用户的地方,让数据的多个副本处于临近的数据中心,同时让一个EntityGroup的数据连续存储,尽量由一个TabletServer提供服务。唯一看起来有影响的是,写操作需要同步给所有副本,相关副本要么写入数据,要么标记自己的数据不是最新。
不过我在Spanner论文第6节Related Work中找到了答案,Megastore does not achieve high performance. It is layered on top of Bigtable, which imposes high communication costs. It also does not support long-lived leaders: multiple replicas may initiate writes. All writes from different replicas necessarily conflict in the Paxos protocol, even if they do not logically conflict: throughput collapses on a Paxos group at several writes per second. 主要原因有两个,一个是Bigtable带来高昂的通信成本,另一个是没有租期的Paxos Leader导致没有必要的写冲突。