What is the relationship between dubbo and zookeeper? The following article will introduce to you the relationship between dubbo and zookeeper. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Dubbo recommends using Zookeeper as the service registration center.
1. The role of Zookeeper:
zookeeper is used to register services and perform load balancing. Which service is provided by which machine must be known to the caller. Simple In other words, it is the correspondence between the IP address and the service name. Of course, this correspondence can also be implemented in the caller's business code through hard coding. However, if the machine that provides the service hangs up, the caller has no way of knowing. If the code is not changed, it will continue to request the dead machine to provide services. Zookeeper can detect the hung machine through the heartbeat mechanism and delete the corresponding relationship between the IP and service of the hung machine from the list. As for supporting high concurrency, simply speaking, it means horizontal expansion, increasing computing power by adding machines without changing the code. By adding new machines to register services with ZooKeeper, the more service providers there are, the more customers they can serve.
2. The role of dubbo:
Dubbo is a tool for managing the middle layer. There are many services between the business layer and the data warehouse. Service providers need scheduling, and dubbo provides a framework to solve this problem.
Note that the dubbo here is just a frame. What you put on the shelf is completely up to you, just like a car skeleton, you need to match your wheel engine. To complete the scheduling in this framework, there must be a distributed registration center to store the metadata of all services. You can use zk or others, but everyone uses zk.
3. The relationship between zookeeper and dubbo:
Dubbo abstracts the registration center so that it can connect to different storage media to provide services to the registration center. The introduction of zookeeper as a storage medium also introduces the features of zookeeper.
The first is load balancing: the carrying capacity of a single registration center is limited. When the traffic reaches a certain level, it needs to be diverted. Load balancing exists for the purpose of diverting traffic. A zookeeper cluster cooperates The corresponding web application can easily achieve load balancing;
Resource synchronization: load balancing alone is not enough, the data and resources between nodes need to be synchronized, and the zookeeper cluster naturally has Such a function;
Naming service: uses a tree structure to maintain a global service address list. When the service provider starts, it writes to the specified node directory on zookeeper. own URL address, this operation completes the release of the service
Mast: ZooKeeper can ensure that the client cannot create an existing ZNode. That is to say, if multiple clients request to create the same temporary node at the same time, only one client request will be successfully created in the end. Using this feature, you can easily conduct Master election in a distributed environment.
Distributed lock: Distributed lock is a way to control synchronous access to shared resources between distributed systems. If the client machine that currently obtains the lock crashes or restarts, the temporary node will be deleted and the lock will be released. After the business logic is executed normally, the client will actively delete the temporary node it created and release the lock.
For more related knowledge, please pay attention to PHP Chinese website! !
The above is the detailed content of What is the relationship between dubbo and zookeeper?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version
God-level code editing software (SublimeText3)