zookeeper 内部蹩脚问题(未回答完)


 1.     说说zookeeper和chubby的Snapshots

Zookeeper使用的是fuzzy snapshot,中文意思大概是模糊的snapshot,但是,论文wait-free说到可能会有notvalid的时候

Chubby同样具有snapshots ,用了三种方式,原文是这样的:

Our firstimplementation of the fault-tolerant database blocked the system very brieflywhile making an in-memory copy of the (small) database. It then stored thecopied data on disk via a separate thread. Subsequently we implementedvirtually pause-less snapshots. We now use a “shadow” data structure totrack updates while the underlying database is serialized to disk.

 

 

2.     Leader是干嘛用的?

 To assign serial id's to all updates andconfirm that a quorum has received the update.

 

3.      Zookeeper可以干什么(答案应该比较多)

 event notification,locking, and as a priority queue mechanism另一个方面,对于read非常多的应用程序适合使用,因为Replication is used for scalability andreliability 

 

4.      为什么说zookeeper不能做数据存储?

Using a memorybased system also mean you are limited to the amount of data that can fit inmemory, so it's not useful as a general data store.

It's meant tostore small bits of configuration information rather than large blobs.

 

 

5.      为什么说ZooKeeper 比起事件通知系统更像是一个基于状态的系统? 

Watches are set as a side-effect of gettingdata so you'll always have a valid initial state and on any subsequent changeevents you'll refresh to get new values. If you want to use events to log whenand how something changed, for example, then you can't do that. You would haveto include change history in the data itself. 

 

6.      Watch事件?

可以watch的event包括如下的二种:

KeeperState:Disconnected,SyncConnected,Expired

EventType:None,NodeCreated,NodeDeleted,NodeDataChanged,NodeChildrenChanged

 

7.      Zookeeper有冲突的问题吗?

ZK那样一开始就提出对/zk/a,可能会有两个请求同时提交要更新该值会抛出BadVersion的异常,另外i,因为所有的zxid分配都是leader分配的,在最坏的情况下,leader刚把写请求发送出去后,挂了,同时,更为糟糕的是,所有的followers都没有收到该请求,重新选择leader后,那么为了保证每一个proposal都有一个唯一的id,新的leader的赋予了一个新的epoch,这就区别前一个的leader,前一个leader(此时不是leader)又活过来,则它的那个未发出的消息则会被truncate掉

 

8.      Zookeeper有活锁的问题吗?

不会有活锁问题,对于同时处理同一个值的话,leader只会重新将该值的请求发送给自己来再次提交。

 

9.      Libpaxos和chubby的活锁问题是如何解决的?

难道使用的是paxos made simple中提到的If the distinguished proposer can communicate successfully with amajority of acceptors, and if it uses a proposal with number greater than anyalready used, then it will succeed in issuing a proposal that is accepted. Byabandoning a proposal and trying again if it learns about some request with ahigher proposal number, the distinguished proposer will eventually choose ahigh enough proposal number.

 

10.  Zookeeper为什么需要两阶段?

Paxos之所以使用两阶段,是因为需要第一阶段来保证有大多数的acceptors选择了proposal,zookeeper的话,如果稳定下来,是不是直接就可以一次提交了呢?这个需要确认一下

 

11.  Zookeeper怎么知道其他的Followersproposal都commit了呢?

It accomplishes this taskby queuing to a newly connected follower any PROPOSAL it has that the followerhas not seen, and then queuing a COM-MIT for all such proposals up to the lastmessage committed. After all such messages have been queued, the leader adds thefollower to the broadcast list for future PROPOSALs and ACKs

 

12.  Session id的初始化?

Id为server id

   longnextSid = 0;

   longmill = System.currentTimeMillis();

   nextSid= (System.currentTimeMillis() << 24) >> 8;

   nextSid=  nextSid | (id <<56);


13.  什么叫做idempotent,?

14.  zookeeper写请求是怎么样的工作流程?

15.  Zab does notpersistently record the id of every message delivered, Zab may redeliver amessage during recovery?

16.  写请求流程?

17.  Redelivery使用在zookeeper哪里?

 

 

 

论文:

[1] zookeeper:wait-free http://static.usenix.org/event/usenix10/tech/full_papers/Hunt.pdf

[2] A simple totally ordered broadcastprotocol http://research.yahoo.com/files/ladis08.pdf

你可能感兴趣的:(算法)