GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — add . · earlBell/Java-Interview-Advanced@f9d8506

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • README.md
  • docs/distributed-system
    • images
      • zookeeper-distribute-lock-optimize.png
      • zookeeper-distribute-lock.png
    • zookeeper-distribute-lock-optimize.md
    • zookeeper-distribute-lock-scheme.md
    • zookeeper-distribute-lock-split-brain.md
    • zookeeper-distribute-lock.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+4Lines changed: 4 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@
226226
- [50、你们是用哪个开源框架实现的Redis分布式锁?能说说其核心原理么?](/docs/distributed-system/redis-distribute-lock.md)
227227
- [51、如果Redis是集群部署的,那么集群故障时分布式锁还有效么?](/docs/distributed-system/hitch-redis-distribute-lock.md)
228228
- [52、作业:自己梳理出来Redis分布式锁的生产问题解决方案](/docs/distributed-system/work-redis-distribute-lock.md)
229+
- [53、如果要实现ZooKeeper分布式锁,一般用哪个开源框架?核心原理是什么?](/docs/distributed-system/zookeeper-distribute-lock.md)
230+
- [54、对于ZooKeeper的羊群效应,分布式锁实现应该如何优化?](/docs/distributed-system/zookeeper-distribute-lock-optimize.md)
231+
- [55、如果遇到ZooKeeper脑裂问题,分布式锁应该如何保证健壮性?](/docs/distributed-system/zookeeper-distribute-lock-split-brain.md)
232+
- [56、作业:自己梳理出来ZooKeeper分布式锁的生产问题解决方案](/docs/distributed-system/zookeeper-distribute-lock-scheme.md)
229233

230234

231235

Collapse file

‎docs/distributed-system/images/zookeeper-distribute-lock-optimize.png‎

Copy file name to clipboard
49.8 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎docs/distributed-system/images/zookeeper-distribute-lock.png‎

Copy file name to clipboard
88.5 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎docs/distributed-system/zookeeper-distribute-lock-optimize.md‎

Copy file name to clipboard
+12Lines changed: 12 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
![zookeeper-distribute-lock-optimize](/docs/distributed-system/images/zookeeper-distribute-lock-optimize.png)
3+
也可以,羊群效应
4+
5+
如果几十个客户端同时争抢一个锁,此时会导致任何一个客户端释放锁的时候,zk反向通知几十个客户端,几十个客户端又要发送请求到zk去尝试创建锁,所以大家会发现,几十个人要加锁,大家乱糟糟的,无序的
6+
7+
羊群效应
8+
9+
造成很多没必要的请求和网络开销,会加重网络的负载
10+
11+
12+
Collapse file

‎docs/distributed-system/zookeeper-distribute-lock-scheme.md‎

Copy file name to clipboard
+11Lines changed: 11 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
Redis和ZooKeeper,哪种分布式锁更好?
3+
4+
从分布式系统协调语义而言,是ZooKeeper做分布式锁更好一些,因为Redis本身其实是缓存,但是Redis能抗高并发,高并发场景下更好一些
5+
6+
zookeeper本身不适合部署大规模集群,他本身适用的场景就是部署三五台机器,不是承载高并发请求的,仅仅是用作分布式系统的协调的
7+
8+
9+
Redis?ZooKeeper?
10+
11+
有redis集群,没有zookeeper集群,那你当然就选择redis了;如果你们公司两个都有,用哪种分布式锁都可以,高并发场景,redis
Collapse file

‎docs/distributed-system/zookeeper-distribute-lock-split-brain.md‎

Copy file name to clipboard
+6Lines changed: 6 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
分布式锁脑裂,重复加锁
3+
4+
分布式系统,主控节点有一个Master,此时因为网络故障,导致其他人以为这个Master不可用了,其他节点出现了别的Master,导致集群里有2个Master同时在运行
5+
6+
curator框架源码,加一些协调机制
Collapse file

‎docs/distributed-system/zookeeper-distribute-lock.md‎

Copy file name to clipboard
+10Lines changed: 10 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
看图说话
3+
![distributed-lock](/docs/distributed-system/images/zookeeper-distribute-lock.png)
4+
一般很少自己手撸,curator,基于zk实现了一整套的高级功能
5+
6+
product_1_stock
7+
8+
curator.lock(“product_1_stock”)
9+
10+
/locks/product_1_stock

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.