Learn from me springmvc integrate dubbo-Introduction (1)

Learn from me springmvc integrate dubbo-Introduction (1)

Summary:

Dubbo is a distributed service framework dedicated to providing high-performance and transparent RPC remote service invocation solutions and SOA service governance solutions. Simply put, dubbo is a service framework. If there is no distributed requirement, it is actually unnecessary. Only when it is distributed, there is a requirement for a distributed service framework like dubbo, and it is essentially a service call. Dongdong, to put it bluntly, it is a distributed framework for remote service invocation (Farewell to Web

WSdl in Service mode is registered on dubbo in the manner of server and consumer)

1. What is Dubbo?

Dubbo is a distributed service framework dedicated to providing high-performance and transparent RPC remote service invocation solutions and SOA service governance solutions. Simply put, dubbo is a service framework. If there is no distributed requirement, it is actually unnecessary. Only when it is distributed, there is a requirement for a distributed service framework like dubbo, and it is essentially a service call. Dongdong, to put it bluntly, it is a distributed framework for remote service invocation (say goodbye to WSdl in the Web Service mode, register on dubbo in the manner of service providers and consumers)

Its core parts include:

1. Remote communication: Provides abstract encapsulation of a variety of NIO frameworks based on persistent connections, including multiple thread models, serialization, and information exchange methods in the "request-response" mode.

2. Cluster fault tolerance: Provides transparent remote procedure calls based on interface methods, including multi-protocol support, and cluster support such as soft load balancing, failure tolerance, address routing, and dynamic configuration.

3. Automatic discovery: Based on the registration center directory service, the service consumer can dynamically find the service provider, make the address transparent, and enable the service provider to smoothly increase or decrease the number of machines.

2. What can Dubbo do?

1. Transparent remote method call, just like calling a local method to call a remote method, only simple configuration, no API intrusion.

2. The soft load balancing and fault tolerance mechanism can replace hardware load balancers such as F5 in the intranet, reducing costs and reducing single points.

3. Automatic registration and discovery of services, no need to write down the address of the service provider, the registration center queries the IP address of the service provider based on the interface name, and can smoothly add or delete service providers.

Dubbo adopts the all-Spring configuration method, transparent access to the application, without any API intrusion to the application, just use Spring to load the Dubbo configuration, and Dubbo is loaded based on Spring's Schema extension.

3. The architecture of dubbo

The architecture diagram of dubbo is as follows:



Node role description:

Provider: The service provider that exposes the service.

Consumer: The service consumer who calls the remote service.

Registry: The registry for service registration and discovery.

Monitor: A monitoring center that counts the call times and call times of the service.

Container: The service running container.

I think this is very good, the roles are distinct, and the status of each node's role can be used to determine whether the service is normal.

Calling relationship description:

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

1. When the service provider starts, register the service it provides with the registration center.

2. When the service consumer starts, he subscribes to the registry for the service he needs.

3. The registration center returns the list of service provider addresses to the consumer. If there is a change, the registration center will push the change data to the consumer based on the long connection.

4. Service consumers, from the provider address list, based on the soft load balancing algorithm, select one provider to call, and if the call fails, select another call.

5. Service consumers and providers accumulate the number of calls and call time in the memory, and send statistical data to the monitoring center every minute.

The fault tolerance of dubbo is obvious, and the performance has not yet been tested. A page of our system needs to be dropped 5 times. I originally wanted to recommend a cache, but the business relationship cannot be adopted. We need to study the performance tuning of dubbo.. .

4. How to use dubbo.

Dubbo adopts the all-Spring configuration method, transparent access to the application, without any API intrusion to the application, just use Spring to load the Dubbo configuration, and Dubbo is loaded based on Spring's Schema extension. If you do not want to use Spring configuration, but want to call through API (not recommended)

Let's take a step-by-step analysis of how to use dubbo

Please continue to pay attention to "Follow me to learn dubbo-ZooKeeper registration center installation (2)"

Core technology: Maven, Springmvc mybatis shiro, Druid, Restful, Dubbo, ZooKeeper, Redis, FastDFS, ActiveMQ, Nginx

1. Screenshot of the core code structure of the project



Friends who are willing to understand the framework technology or source code directly ask for exchange and sharing of technology: 2042849237

Some of the distributed solutions, friends who are willing to know can find our team to discuss