Before learning Zookeeper in depth, I would like to introduce you to an application example related to Zookeeper. I named this example as remote call service. Through the description of this application example, we will have a deep understanding of the application scenario of Zookeeper. Remote call is a communication mechanism between systems. Another way to understand it is inter-process communication. Remote call technology is the core technology for distributed system development. Remote call technology can form a group of computer systems into a network system and provide overall services to the outside world. Then this group of computer systems constitutes a larger and higher-performance computer system. In my previous blog, I introduced a distributed website architecture design, in which a component written using netty technology is used as a medium for communication between the front-end system and the server system. In a large Internet company, there will be many such website systems. If each website is developed as described in my blog, then there will be certain problems with the maintenance and management of system communication and the allocation and management of network resources for each system. For such problems, I will give you an example so that you may understand it better. For example, an Internet company has several websites that provide services to the outside world. Some websites have a large number of visits, while others are relatively small. However, the company's broadband resources are limited. Then we hope to dynamically manage and allocate these resources. If the communication function of our website is tightly coupled with the website, then the work of allocating these resources will be more complicated and cumbersome, and it is easy to cause problems. There will be many such problems, and I will not analyze them in detail here. When doing software development, there is a principle that if a certain function can be used universally and the function needs to be managed uniformly, we should extract this function into an independent system or component, and give this system or component some enhanced functional features, which will definitely improve the robustness, availability and efficiency of the entire system. The communication technology I described in the distributed website is a kind of remote call technology. Remote call technology is the communication technology between the client and the server. It can be regarded as a kind of cs architecture technology. There are many excellent frameworks in Java to implement remote calls, such as RMI that comes with Java, Httpinvoker that comes with spring, webservice technology, etc. However, these existing technologies cannot meet the remote call needs of Internet companies. Today I will talk about a set of remote call technologies that I conceived myself, which is based on the practices of some similar software in our company. This framework is mainly for Java, and other languages are not currently supported. First, I would like to summarize the technologies that remote call technology should include, which are:
In addition to the above functions, I hope that the remote call framework I designed here can also have a heartbeat management mechanism, a timeout management mechanism, and a service classification management mechanism, that is, it can adjust network resources according to the importance of the service or the busyness of the system. Haha, I've been talking for so long, and some of you may be a little annoyed. Didn't I say that I would use Zookeeper as an example? Why haven't I seen any trace of Zookeeper yet? Don't worry, Zookeeper will be on the scene soon. Let’s start with the distributed website I wrote in my previous blog. We can regard the server system as the service provider and the front-end system as the service caller. The provider can be compared to the merchant and the caller can be compared to the customer. Merchants and customers can conduct transactions directly. This direct transaction method is very primitive and may even have risks. In modern society, direct transactions between merchants and customers are very efficient. The reason for this efficiency is that there is a large and standardized market. Transactions between merchants and customers are conducted in the market, which makes transactions safer and more efficient. The biggest feature of the distributed framework I designed is that it provides a market-like role to manage service providers and service callers. I call this functional module the remote call management component. The remote call management component is the core of this framework. Its main function is to receive registration notifications from service providers. The notifications are generally interfaces, implementation classes of the interfaces, and the IP addresses of servers. The management component will record these notifications and group and mark these service programs according to the configuration. The registered information management component will push this information to the service caller. The remote call management component also includes a heartbeat mechanism, which is for service providers. The heartbeat mechanism detects the health status of service providers. The management component will not detect the health status of service callers because it is unnecessary. This is because the use of this framework is still for callers to directly request providers. Logically, there is no need to care about the status of the caller. This is the same as the browser in the BS architecture. We don’t care whether the browser user exists. The relationship between the service provider, service caller, and remote call management component is shown in the following figure: The remote call framework runs as follows: when the service provider starts, it transmits its IP address and registration method to the remote call management component. The management component receives the registration information and stores it. The storage technology uses Zookeeper. After the storage is successful, the management component will send a successful notification back to the service provider. At the same time, the management component will detect whether the service provider is healthy through heartbeats. When the service caller starts, it will request the service provider information from the management component. After receiving the request, the management component will push the relevant information to the service caller. When the actual system is running, the service caller communicates directly with the service provider. The communication method is Netty. If there are relevant changes between the caller and the provider, they will first notify the service management component, and the service management component will push the relevant change information to the corresponding system. The remote call management component is mainly implemented through Zookeeper. Zookeeper has a hierarchical namespace. Its model is a tree structure. The tree structure is a powerful data type that can store almost all different data types. We save this information through Zookeeper to facilitate our management of the entire remote call framework. At the same time, Zookeeper is highly reliable, which I mentioned in the previous Zookeeper article. This ensures the stability of the entire remote call framework. In actual applications, we will compile the components into a jar package, and different projects will directly reference this jar package, so that the management component server and the service provider and caller are connected. As for the communication mechanism between the provider and the caller, it is carried out directly, because we integrate the communication program in the jar package, but the corresponding management mechanism is extracted to the external server for unified management. This is the remote call framework I designed. Unfortunately, I have not actually implemented this idea yet. I brought it out today to demonstrate the practical application of Zookeeper and to pave the way for my later explanation of Zookeeper. As for whether it is feasible, it depends on whether there is a chance to develop a similar system in the future. By then, I guess there will be many unexpected problems to be solved. (The design of the remote call service was based on the design of my technical friend Ma Dexin, who was once a technical architect of Taobao) |
<<: Let's talk about how to achieve high performance with CQRS architecture
>>: Neural network basics: seven network units, four layer connection methods
Why is it that even though some products are rare...
In today's world of information explosion and...
Today I would like to talk to you about the value...
I used to think about this question often when I ...
The vast sky and the starry sky have been fascina...
The history of human civilization is accompanied ...
Many mobile phones now have waterproof features, ...
1. What is the user system? Before talking about ...
I have read many books on training marketing dire...
(1). The keywords of plan 1 are affected by the c...
How to purchase the video of African children hol...
Uncle San - 2022 latest full-price account gamepla...
If the Earth is likened to a huge dynasty, then h...
On March 20, the Belmont Health Department in Mas...
After the college entrance examination results ar...