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

相关文章

Zookeeper安装和配置说明

一、Zookeeper的搭建方式 Zookeeper安装方式有三种,单机模式和集群模式以及伪集群模式。 ■ 单机模式:Zookeeper只运行在一台服务器上,适合测试环境; ■ 伪集群模式:就是在一台物理机上运行多个Zookeeper 实例; ■ 集群模式:Zookeeper运行于一个集群上,适合生产环境,这个计算机集群被称为一个“集合体”(ensemble) Zookeeper通过复制来实现

好题——hdu2522(小数问题:求1/n的第一个循环节)

好喜欢这题,第一次做小数问题,一开始真心没思路,然后参考了网上的一些资料。 知识点***********************************无限不循环小数即无理数,不能写作两整数之比*****************************(一开始没想到,小学没学好) 此题1/n肯定是一个有限循环小数,了解这些后就能做此题了。 按照除法的机制,用一个函数表示出来就可以了,代码如下

hdu1043(八数码问题,广搜 + hash(实现状态压缩) )

利用康拓展开将一个排列映射成一个自然数,然后就变成了普通的广搜题。 #include<iostream>#include<algorithm>#include<string>#include<stack>#include<queue>#include<map>#include<stdio.h>#include<stdlib.h>#include<ctype.h>#inclu

购买磨轮平衡机时应该注意什么问题和技巧

在购买磨轮平衡机时,您应该注意以下几个关键点: 平衡精度 平衡精度是衡量平衡机性能的核心指标,直接影响到不平衡量的检测与校准的准确性,从而决定磨轮的振动和噪声水平。高精度的平衡机能显著减少振动和噪声,提高磨削加工的精度。 转速范围 宽广的转速范围意味着平衡机能够处理更多种类的磨轮,适应不同的工作条件和规格要求。 振动监测能力 振动监测能力是评估平衡机性能的重要因素。通过传感器实时监

搭建Kafka+zookeeper集群调度

前言 硬件环境 172.18.0.5        kafkazk1        Kafka+zookeeper                Kafka Broker集群 172.18.0.6        kafkazk2        Kafka+zookeeper                Kafka Broker集群 172.18.0.7        kafkazk3

缓存雪崩问题

缓存雪崩是缓存中大量key失效后当高并发到来时导致大量请求到数据库,瞬间耗尽数据库资源,导致数据库无法使用。 解决方案: 1、使用锁进行控制 2、对同一类型信息的key设置不同的过期时间 3、缓存预热 1. 什么是缓存雪崩 缓存雪崩是指在短时间内,大量缓存数据同时失效,导致所有请求直接涌向数据库,瞬间增加数据库的负载压力,可能导致数据库性能下降甚至崩溃。这种情况往往发生在缓存中大量 k

6.1.数据结构-c/c++堆详解下篇(堆排序,TopK问题)

上篇:6.1.数据结构-c/c++模拟实现堆上篇(向下,上调整算法,建堆,增删数据)-CSDN博客 本章重点 1.使用堆来完成堆排序 2.使用堆解决TopK问题 目录 一.堆排序 1.1 思路 1.2 代码 1.3 简单测试 二.TopK问题 2.1 思路(求最小): 2.2 C语言代码(手写堆) 2.3 C++代码(使用优先级队列 priority_queue)

【VUE】跨域问题的概念,以及解决方法。

目录 1.跨域概念 2.解决方法 2.1 配置网络请求代理 2.2 使用@CrossOrigin 注解 2.3 通过配置文件实现跨域 2.4 添加 CorsWebFilter 来解决跨域问题 1.跨域概念 跨域问题是由于浏览器实施了同源策略,该策略要求请求的域名、协议和端口必须与提供资源的服务相同。如果不相同,则需要服务器显式地允许这种跨域请求。一般在springbo

题目1254:N皇后问题

题目1254:N皇后问题 时间限制:1 秒 内存限制:128 兆 特殊判题:否 题目描述: N皇后问题,即在N*N的方格棋盘内放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在同一斜线上。因为皇后可以直走,横走和斜走如下图)。 你的任务是,对于给定的N,求出有多少种合法的放置方法。输出N皇后问题所有不同的摆放情况个数。 输入

vscode中文乱码问题,注释,终端,调试乱码一劳永逸版

忘记咋回事突然出现了乱码问题,很多方法都试了,注释乱码解决了,终端又乱码,调试窗口也乱码,最后经过本人不懈努力,终于全部解决了,现在分享给大家我的方法。 乱码的原因是各个地方用的编码格式不统一,所以把他们设成统一的utf8. 1.电脑的编码格式 开始-设置-时间和语言-语言和区域 管理语言设置-更改系统区域设置-勾选Bata版:使用utf8-确定-然后按指示重启 2.vscode