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

相关文章

Flask解决指定端口无法生效问题

《Flask解决指定端口无法生效问题》文章讲述了在使用PyCharm开发Flask应用时,启动地址与手动指定的IP端口不一致的问题,通过修改PyCharm的运行配置,将Flask项目的运行模式从Fla... 目录android问题重现解决方案问题重现手动指定的IP端口是app.run(host='0.0.

Seata之分布式事务问题及解决方案

《Seata之分布式事务问题及解决方案》:本文主要介绍Seata之分布式事务问题及解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录Seata–分布式事务解决方案简介同类产品对比环境搭建1.微服务2.SQL3.seata-server4.微服务配置事务模式1

Java捕获ThreadPoolExecutor内部线程异常的四种方法

《Java捕获ThreadPoolExecutor内部线程异常的四种方法》这篇文章主要为大家详细介绍了Java捕获ThreadPoolExecutor内部线程异常的四种方法,文中的示例代码讲解详细,感... 目录方案 1方案 2方案 3方案 4结论方案 1使用 execute + try-catch 记录

mysql关联查询速度慢的问题及解决

《mysql关联查询速度慢的问题及解决》:本文主要介绍mysql关联查询速度慢的问题及解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录mysql关联查询速度慢1. 记录原因1.1 在一次线上的服务中1.2 最终发现2. 解决方案3. 具体操作总结mysql

一文教你解决Python不支持中文路径的问题

《一文教你解决Python不支持中文路径的问题》Python是一种广泛使用的高级编程语言,然而在处理包含中文字符的文件路径时,Python有时会表现出一些不友好的行为,下面小编就来为大家介绍一下具体的... 目录问题背景解决方案1. 设置正确的文件编码2. 使用pathlib模块3. 转换路径为Unicod

Spring MVC跨域问题及解决

《SpringMVC跨域问题及解决》:本文主要介绍SpringMVC跨域问题及解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录跨域问题不同的域同源策略解决方法1.CORS2.jsONP3.局部解决方案4.全局解决方法总结跨域问题不同的域协议、域名、端口

SpringBoot自定义注解如何解决公共字段填充问题

《SpringBoot自定义注解如何解决公共字段填充问题》本文介绍了在系统开发中,如何使用AOP切面编程实现公共字段自动填充的功能,从而简化代码,通过自定义注解和切面类,可以统一处理创建时间和修改时间... 目录1.1 问题分析1.2 实现思路1.3 代码开发1.3.1 步骤一1.3.2 步骤二1.3.3

基于.NET编写工具类解决JSON乱码问题

《基于.NET编写工具类解决JSON乱码问题》在开发过程中,我们经常会遇到JSON数据处理的问题,尤其是在数据传输和解析过程中,很容易出现编码错误导致的乱码问题,下面我们就来编写一个.NET工具类来解... 目录问题背景核心原理工具类实现使用示例总结在开发过程中,我们经常会遇到jsON数据处理的问题,尤其是

springboot3.4和mybatis plus的版本问题的解决

《springboot3.4和mybatisplus的版本问题的解决》本文主要介绍了springboot3.4和mybatisplus的版本问题的解决,主要由于SpringBoot3.4与MyBat... 报错1:spring-boot-starter/3.4.0/spring-boot-starter-

在 Spring Boot 中使用异步线程时的 HttpServletRequest 复用问题记录

《在SpringBoot中使用异步线程时的HttpServletRequest复用问题记录》文章讨论了在SpringBoot中使用异步线程时,由于HttpServletRequest复用导致... 目录一、问题描述:异步线程操作导致请求复用时 Cookie 解析失败1. 场景背景2. 问题根源二、问题详细分