简单的分布式系统主要存在的问题
1. scalability, dynamo中consistent hashing+virtual node
2. high availability。肯定想到replication,然后自然就有vector clock解决多版本问题
3. single failure point, dynamo完全peer to peer
细节详见http://blog.csdn.net/zgl_dm/article/details/6291984
problem | technique | advantage |
---|---|---|
partitioning | consistent hashing | incremental scalability |
high availability for writes | vector clocks with reconciliation during reads | version size is decoupled from update rates |
handling temp failures | sloppy quorum and hinted handoff | provides ha and durability when some replicas arenot available |
recovering from permanent failures | anti-entropy using Merkle trees | synchronizes divergent replicas in the back ground |
membership and failure detection | gossip-based membership protocol and failure detection | preserve symmetry, avoids a centralized registry |
consistent hashing解决partition之后,还要用virtual node保证load balance。
0-2^31-1的环划分Q个区(就是virtual node),一共S个机器,每个分Q/S.- 一个node(物理)离开,这个node cover的partitions均匀散布到其他node
- 新的node加入,steal partitions from other nodes
这个策略要求Q>>s, 如果有N 个备份,Q>>S*N
- 工业界一般认为比较安全的备份数是3份(加起来一共3份).
replication,系统中每个节点负责环上的从其自己到第 N 个前继节点间的一段区域,存在preferred list中
NWR模型:N个备份,每次读至少读R个备份,至少写W个备份
要求R>N-W,保证每次读取至少有一个最新的版本。
e.g. 高可读环境R=N=W=1, 高可写环境(amazon的购物车请求) W=1 R=N=3
vector lock 模型 (和innodb的MVCC类似),版本号+修改的node
-
- 4.
- 和经典的quorum差不多