Senior architect programming students will take you through distributed locking from zero to one in the short book Hello, Distributed Locking.
🎙️ Author introduction
Elementary school students in the programming world, Senior Architect.
Worked for Baidu Mobile in Beijing and learned from who. Participated in the design, development and infrastructure work of million/ten million level high concurrency C-terminal system, led the delay messaging of RocketMQ to enable custom delay level of duration, lossless publishing of Eureka, and Sentinel flow limiting to support different limits for different interface calls.
🤔️ Why learn distributed locking?
Today belongs to the Internet era, rather than the traditional era, Internet projects are mostly distributed and cluster deployment, because it can greatly improve the concurrency of services, but the distribution will also bring some new problems, such as: distributed lock, distributed transaction, distributed ID and other such problems.
So why learn distributed locking?
First of all, it is one of the basic core technologies necessary for current Internet projects. Second, it is also a kind of interview question that is often asked in interviews. For example, have you ever had one of the following head-scratchers:
- E-commerce platform promotion, concurrent traffic is large, resulting in oversold inventory.
- Users pull new, set up a system for registered users to draw a lottery, the prize is iPhone13 Pro and the number of prizes is only one, but many people draw at the same time, that is not a loss of money?
- The company does not have a distributed scheduling system, but performs a scheduled task. After the cluster is deployed, each machine in the cluster performs the scheduled task repeatedly.
- …
These problems are common in today’s Internet age, but how can we solve them? Some practitioners may know to use distributed locks to solve this problem, but which distributed locks to use? What about performance and security? … A series of black box problems are coming up.
And these problems, it is “Hello, distributed lock” this small volume needs to solve.
💡 common learning pain points and booklet highlights
In fact, you go to the Internet with the words “distributed lock” search words, can search to countless articles, however, go to online search professionals should know a little, that is: the Internet is just tell you distributed lock API, how to use, but does not explain the use of the correct posture, which implementation ways are there, and what are the pros and cons of each. There may be a series of articles on distributed locking starting at 0 and going all the way to the source level, but there are really very few good articles. Most of them are personal notes, not articles. Because almost 90% of the articles are directly posted source, write a good comment, a better article will match the above. These are actually difficult to read, and even if you do, you understand the source code flow, that’s all.
So what’s the highlight of our little book?
This booklet will analyze distributed locks from 0 to 1, but will not begin with a source code analysis, but will take the “How to Design a distributed lock?” This kind of deductive teaching method, takes you to learn the design idea among them first. , for example, to design a distributed read-write lock, that this small book will take you to take what kind of data structure to store, to read and write the mutex do, read sharing demand such as how to do it step by step to complete design thought is deduced, and then took us this design thoughts go deep into the source of the open source framework to verify whether this implementation.
The design idea is the requirement of source code. If you don’t understand the requirements, how can you develop them? Catch the thief, the king (demand) done, the following soldier (source) is easy to break.
🏆 What can you learn from this booklet
This small volume mainly has three core modules: basic, core, advanced. In addition, there will be a supplementary module as an extension.
- You can start your
Based on article
Learn what locks are, what distributed locks are, and the core principles of distributed locks.
- After mastering the basics of distributed locking, come
Core article
, in the core you will learn Redis and ZooKeeper to achieve distributed lock all the design ideas and core source code, of course, will also analyze the interview often asked WatchDog implementation principle.
- Finally, in
Advanced article
Will take you hand in hand to analyze how to design some advanced locks, such as distributed fair lock/unfair lock, distributed read and write lock, red lock and other core design ideas and source code.
For the whole knowledge system, you can refer to the following knowledge map 👇 :
So here’s what you can learn from this little book:
- What distributed locking is and the pros and cons of each implementation;
- Redis distributed lock core design ideas and source code;
- ZooKeeper distributed lock core design ideas and source code;
- Distributed fair lock/unfair lock, distributed read and write lock, red lock design ideas and source code;
- No stranger to distributed locks, you can also write an advanced distributed lock by hand.
Finally, I want to say, if you have experience in Internet project, know what is a distributed lock but I don’t know its implementation principle, distributed or used locks, but want to systematically study the design of distributed lock core principle and core source code, or want to write a senior lock but don’t know where to start, can join us in this little book learning.
I very much look forward to your joining, looking forward to go hand in hand with you 🤝, take the long wind, break thousands of waves 🌊, set foot on the journey of distributed lock ⛵️.
50% off, limited time 14.95 yuan, can be purchased at sourl.co/fynt9p
👇 can also be stamped below the poster or scan the poster TWO-DIMENSIONAL code, you can permanently unlock ~ join the learning ~