Open source distributed service framework

1.Dubbo is an open source high-performance service framework of Alibaba, which enables applications to realize the output and input functions of services through high-performance RPC and can be seamlessly integrated with Spring framework.

Dubbo is a high-performance, lightweight, open source Java RPC framework that provides three core capabilities: (1) Interface-oriented remote method invocation; ② Intelligent fault tolerance and load balancing; ③ Automatic service registration and discovery.

2. The structure of

Node roles:

Provider: exposes the service Provider of the service.

Consumer: Service Consumer that invokes the remote service.

Registry: A Registry where services are registered and discovered.

Monitor: monitors the number and duration of service invocation.

Container: service running Container.

Call Relationship Description

The 0 service container is responsible for starting, loading, and running the service provider provider.

1 Service provider At startup, the provider registers the services it can provide with the registry (through clients that connect to the server). (Just register the provider’s own IP :port and a description of the service it provides, such as what it can do!)

2 Service Consumer At startup, consumers subscribe to the registry for the services they need. And register their own IP :port and other information.

3 The registry returns the service provider address list to consumer. If there is a change, the registry will push the change data to consumer based on the long connection.

4 Service consumer: From the provider provider address list returned by the registry, select one provider to invoke based on the soft load balancing algorithm. If the invocation fails, select another one to invoke.

5 Service consumer and provider accumulate call times and call time in memory, and regularly send statistical data to monitor every minute.

The Dubbo architecture is characterized by connectivity, robustness, scalability, and scalability to future architectures.


2. Dubbo role

Dubbo is actually a middle layer management tool, he is a framework, which can install you want to install the service, the general registry mostly use ZooKeeper, of course, in addition to ZooKeeper, but also Redis can also do registry.

Dubbo+Zookeeper(The registry uses Zookeeper). Zookeeper is actually a tree structure.

Zhang SAN wants to sell his school house in Qinhuai District, Li Si wants to sell his school house in Qixia District, and Wang Wu wants to buy a school house in Qixia District for his child to go to school. After consulting with the agent, The person that the intermediary returned to Meet the needs of Wang Wu was Li Si. Wang Wu got Li Si’s phone number from the intermediary and called Li Si to buy a house.

For example, the Provider is registered with 192.168.1. (Description 121 is eating,122 sleeping, 123 playing games, 124 fitness services)

2-0, dubbo– This is the root node /dubbo that Dubbo created on ZooKeeper

2-1, Dubbo register of nodes on the Zookeeper directory: assumes that the interface name is: com. Bob. Dubbo. Service. CityDubboService.

This is the service node, represents a service/Dubbo Dubbo/com. Bob. Dubbo. Service. CityDubboService

2-2. When Dubbo is started, both the Consumer and Provider format their URL as a string and register it with the corresponding ZooKeeper node as a temporary node. When the connection is disconnected, the node is deleted.

This is the root node of the service provider, its node represents each service of the real provider/dubbo/com. Bob. Dubbo. Service. CityDubboService/will

This is the root node of the service consumer, and its children represent each real consumer of the service; /dubbo/com.bob.dubbo.service.CityDubboService/consumers

2-3. When a Consumer starts up, it doesn’t just register itself with… In the /consumers/ directory, also subscribes… /providers all child nodes in the /providers directory, depending on which node you subscribe to (e.g. fitness), get the URL string of the Provider on it in real time. Register returns the Consumer with an IP address –192.168.1.124. The Consumer takes this IP and goes directly to the Provider to invoke the service — fitness.

2-4, monitoring center started to subscribe to the com. Bob. Dubbo. Service. CityDubboService URL all providers and consumers in the directory.

Dubbo — Zookeeper

Supports the following functions:

The registry can automatically delete provider information in the event of a provider outage such as a power outage

When the registry restarts, the registration data is automatically restored, as well as subscription requests

When the session expires, the registration data can be automatically restored, as well as subscription requests

When <dubbo: Registry check=”false” />, failed registration and subscription requests are recorded and the background periodically retries

You can set <dubbo:registry username=”admin” password=”124″ /> to set the ZooKeeper login information

You can run <dubbo: Registry group=”dubbo” /> to set the root node of ZooKeeper. If this parameter is not set, the rootless tree is used

Support * wildcard
, can subscribe to all groups of the service and all versions of the provider

Supplement:

After consumers obtain the provider address list from ZK, they cache a copy locally. When all nodes of the ZK registry are down, consumers can communicate with the provider using a locally cached list of services.

The significance of ZK is to provide the publishing/subscription service of service address for consumers and providers, so that consumers can perceive the latest service list in time. Consumers really call the provider directly through some communication protocol, and do not rely on ZK.

Therefore, when ZooKeeper breaks down, consumers will not be affected to call service providers. What will be affected is that zK cannot push notification of change to consumers if the provider changes, increases or decreases after ZooKeeper breaks down. Consumers will not pull the latest service list because they cannot perceive the change time. The list of services that cause the local cache may become obsolete.

End, personal understanding, if there is any deviation, please correct, thank you!