In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what are the basic knowledge points of Dubbo". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what are the basic knowledge points of Dubbo.
Dubbo is a distributed services framework, as well as SOA processing solutions. Its functions mainly include: high-performance NIO communication and protocol integration, service dynamic addressing and routing, load balancing and fault tolerance, dependency analysis and degradation. It has five nodes, which are provider,Consumer,Registry,Monitor,container. Where provider is the service provider consumer is the service consumer Registry is the registry where the service is registered and discovered. Monitor is the monitoring center for counting the number and time of service calls, and Container is the service running container.
Consumer is responsible for starting and then running provider. Provider registers its own services with the registry at startup, and consumer subscribes to the registry for its own services at startup, and Registry will push change data to consumer based on persistent connections. Consumer will select a server to call based on the load balancing algorithm. If the call fails, select another server. Provider and consumer accumulate the number and time of calls in memory and regularly send data to monitor every minute.
Dubbo has four characteristics: connectivity, robustness, scalability, and upgrading to future architectures. Connectivity indicates that they have a connection such as a long connection between provider consumer and registry, while provider and consumer report to monitor when they register and subscribe to the registry service. Robustness means stability, for example, when any server in the peer-to-peer cluster of the book registry goes down, it will automatically switch to another. Even if the registry shuts down, service providers and consumers can still communicate through the local cache. Scalability means that new registries and service providers can be added by adding relay deployment instances. Upgrading is the vision of the future architecture mentioned. Compared with the current architecture, it is characterized by the ability to automatically deploy local proxies for services and the ability to automatically increase or decrease service providers through access pressure.
Invocation of service node relationship
1 the service container is responsible for starting, loading and running the service provider
2 the service provider registers its own services with the registry at startup
3 Service consumers subscribe to the services they need from the registry at startup.
4 the registry returns the address list of the service provider to the consumer, and if there is a change, the registry will push the change data to the consumer based on the long connection.
5 based on the load balancing algorithm, the service consumer chooses a provider to call from the provided address list, and then chooses another one to call if the call fails.
(6) Service callers and consumers accumulate the number of calls and call time in memory, and regularly send statistical data to the monitoring center every minute.
How does zookeeper work as a registry for dubbo?
When zookeeper acts as the registry of dubbo, when initializing, the service provider will create a child node under the dubbo node under the zookeeper and the provider node under the service node and write the URL path similar to / dubbo/servicename/providers/,. All the child nodes under this path are service providers. At this time, all nodes are temporary nodes, because the life cycle of the temporary node is related to the client session, so if the machine in which the provider is located fails to provide services, the temporary node will be automatically eliminated from the zookeeper. At this point, because the consumer service provider registry is a long connection, the registry can sense the service provider downtime, it will tell the consumer. The monitoring center is an important part of the Dubbo service governance system, it needs to know the changes of all service providers and providers, so it will register a watcher on the service node to listen for the changes of child nodes at startup, and the path is / dubbo/servicename, so it can also sense the downtime of service providers. The process of creating a service consumer node is the same as that of the provider and is also a temporary node. Another feature is the node structure design of zookeeper, which takes the service name and type, that is, / dubbo/servie, as the node path, meets the requirements of Dubbo subscription and notification, ensures service-oriented change notification, and the notification scope is easy to control. So even if consumers and providers change frequently, it won't have much impact on the performance of zookeeper.
What is Dubbo?
Dubbo is a highly lightweight open source Java RPC framework that provides three core functions: interface-oriented remote method invocation, fault tolerance and load balancing, and automatic service registration and discovery. To put it simply, Dubbo is a distributed services framework, a RPC remote invocation solution dedicated to improving performance and transparency, and a SOA services governance solution.
What is the principle of RPC RPC?
RPC is a remote call, which is a protocol that requests services from computer programs over the network without knowing the underlying network technology. For example, if two different services An and B are deployed on two different machines, what if Service A wants to invoke a method in Service B? use HTTP request, of course, but it will be slow and some optimizations are not good. The emergence of RPC is to solve this problem.
What is the principle of RPC?
Why should I use Dubbo?
The birth of Dubbo has a lot to do with SOA distributed architecture. SOA service-oriented architecture, that is, the project is divided into two projects in the service presentation layer according to the business logic. The service layer contains business logic and only needs to provide services to the outside world. The presentation layer only needs to deal with the interaction with the page, and the business logic is implemented by invoking the services of the service layer. There are two main roles in the SOA architecture: service provider (provider) and service consumer (Cosumer).
If you want to develop distributed programs, you can use the HTTP interface to communicate directly, so why use Dubbo?
You can explain why you use Dubbo from the four features provided by Dubbo?
1 load balancing-which machine should be called when the same service is deployed on different servers.
2 Service invocation link generation-with the development of the system, there are more and more services, and the dependencies between services become so complex that it is difficult to tell which application is started before which application, and the architect can not fully describe the architectural relationship. Dubbo can help us solve the problem of how to invoke between services.
(3) timely statistics of service access pressure, resource adjustment and intensity-manage cluster capacity and improve cluster utilization based on access pressure.
4 Service degradation-invokes a standby service after a service has been hung up.
What is distributed?
Distribution or SOA distribution is important for service orientation. Simple distribution means that we split the whole system into different services and then put these services on different servers to reduce the pressure of single services and improve concurrency and performance. For example, e-commerce system can be divided into order system, commodity system, landing system. After the split, each system can be deployed on different servers, and if the access volume of a service is relatively large, the service can also be deployed on multiple machines at the same time.
Why use distributed?
From the development point of view, the single application code is concentrated together, and the code of the distributed system is split according to the business. So each team can be responsible for the development of a service, which improves the efficiency of development. In addition, the code is easier to maintain and develop after it is split according to the business.
Load balancing Strategy of Dubbo
Explain what is load balancing first?
Wikipedia's definition of load balancing:
For example, if there is a large number of visits to a service in the system, we deploy this service on multiple servers, and when the client initiates a request, multiple servers can process the request. Then it is critical to choose the right server to handle the request. If you need one server to handle these requests, it doesn't make much sense for the service to be deployed on multiple servers. Load balancing is to prevent a single server from responding to the same request, which can easily cause service downtime, crash and other problems.
Load balancing Strategy of Dubbo
1 Random LoadBalance (default, weight-based random load balancing mechanism)
Random setting random probability according to weight has a high probability of collision on a section, but the larger the amount of adjustment is, the more uniform the distribution is, which is beneficial to dynamically adjust the weight of the provider.
2 RoundRobin LoadBalance (not recommended, weight-based polling load balancing mechanism)
Polling, setting the polling rate according to the weight after the convention.
There is a problem with slow providers accumulating requests: for example, the second machine is slow, but does not hang up, gets stuck when the request is transferred to the second machine, and over time, all requests are transferred to the second machine.
3 LeastActive LoadBalance
* the minimum number of active calls is random with the same active number, and the active number refers to the count difference before and after the call.
* causes slower providers to receive fewer requests, because the slower the provider, the greater the difference in count before and after invocation.
4 ConsistentHash LoadBalance
Consistent Hash, requests with the same parameters are always sent to the same provider.
At this point, I believe you have a deeper understanding of "what are the basic knowledge points of Dubbo?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.