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

2024-03-21 17:48

本文主要是介绍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

这篇关于zookeeper 内部蹩脚问题(未回答完)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/833426

相关文章

解决IDEA使用springBoot创建项目,lombok标注实体类后编译无报错,但是运行时报错问题

《解决IDEA使用springBoot创建项目,lombok标注实体类后编译无报错,但是运行时报错问题》文章详细描述了在使用lombok的@Data注解标注实体类时遇到编译无误但运行时报错的问题,分析... 目录问题分析问题解决方案步骤一步骤二步骤三总结问题使用lombok注解@Data标注实体类,编译时

大数据小内存排序问题如何巧妙解决

《大数据小内存排序问题如何巧妙解决》文章介绍了大数据小内存排序的三种方法:数据库排序、分治法和位图法,数据库排序简单但速度慢,对设备要求高;分治法高效但实现复杂;位图法可读性差,但存储空间受限... 目录三种方法:方法概要数据库排序(http://www.chinasem.cn对数据库设备要求较高)分治法(常

Vue项目中Element UI组件未注册的问题原因及解决方法

《Vue项目中ElementUI组件未注册的问题原因及解决方法》在Vue项目中使用ElementUI组件库时,开发者可能会遇到一些常见问题,例如组件未正确注册导致的警告或错误,本文将详细探讨这些问题... 目录引言一、问题背景1.1 错误信息分析1.2 问题原因二、解决方法2.1 全局引入 Element

关于@MapperScan和@ComponentScan的使用问题

《关于@MapperScan和@ComponentScan的使用问题》文章介绍了在使用`@MapperScan`和`@ComponentScan`时可能会遇到的包扫描冲突问题,并提供了解决方法,同时,... 目录@MapperScan和@ComponentScan的使用问题报错如下原因解决办法课外拓展总结@

MybatisGenerator文件生成不出对应文件的问题

《MybatisGenerator文件生成不出对应文件的问题》本文介绍了使用MybatisGenerator生成文件时遇到的问题及解决方法,主要步骤包括检查目标表是否存在、是否能连接到数据库、配置生成... 目录MyBATisGenerator 文件生成不出对应文件先在项目结构里引入“targetProje

C#使用HttpClient进行Post请求出现超时问题的解决及优化

《C#使用HttpClient进行Post请求出现超时问题的解决及优化》最近我的控制台程序发现有时候总是出现请求超时等问题,通常好几分钟最多只有3-4个请求,在使用apipost发现并发10个5分钟也... 目录优化结论单例HttpClient连接池耗尽和并发并发异步最终优化后优化结论我直接上优化结论吧,

Java内存泄漏问题的排查、优化与最佳实践

《Java内存泄漏问题的排查、优化与最佳实践》在Java开发中,内存泄漏是一个常见且令人头疼的问题,内存泄漏指的是程序在运行过程中,已经不再使用的对象没有被及时释放,从而导致内存占用不断增加,最终... 目录引言1. 什么是内存泄漏?常见的内存泄漏情况2. 如何排查 Java 中的内存泄漏?2.1 使用 J

numpy求解线性代数相关问题

《numpy求解线性代数相关问题》本文主要介绍了numpy求解线性代数相关问题,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧... 在numpy中有numpy.array类型和numpy.mat类型,前者是数组类型,后者是矩阵类型。数组

解决systemctl reload nginx重启Nginx服务报错:Job for nginx.service invalid问题

《解决systemctlreloadnginx重启Nginx服务报错:Jobfornginx.serviceinvalid问题》文章描述了通过`systemctlstatusnginx.se... 目录systemctl reload nginx重启Nginx服务报错:Job for nginx.javas

Redis缓存问题与缓存更新机制详解

《Redis缓存问题与缓存更新机制详解》本文主要介绍了缓存问题及其解决方案,包括缓存穿透、缓存击穿、缓存雪崩等问题的成因以及相应的预防和解决方法,同时,还详细探讨了缓存更新机制,包括不同情况下的缓存更... 目录一、缓存问题1.1 缓存穿透1.1.1 问题来源1.1.2 解决方案1.2 缓存击穿1.2.1