In the previous article, we introduce the construction of the Ant-utils Toolkit for building Dubbo distributed platform-maven, starting today, we enter the core tutorial of the Distributed service project and really use Dubbo to implement the distributed service for Enterprise service.
Before learning Dubbo distributed services, we need to understand the Dubbo service tutorial, I will write about Dubbo service articles quickly help you learn.
- What is Dubbo?
Dubbo is a distributed service framework dedicated to providing high-performance and transparent RPC remote service invocation scenarios, as well as SOA service governance scenarios. Simply put, Dubbo is a service framework, if there is no distributed demand, in fact, it is not needed, only in the distributed time, only Dubbo such a distributed service framework needs, and essentially a service call, plainly is a remote service invocation of the distributed framework (farewell to the Web The WSDL in service mode is registered on the Dubbo in the way that the server and the consumer do.
The core part contains:
Remote communication: Provides an abstract encapsulation of various NIO frameworks based on long connections, including multiple threading models, serialization, and "request-response" mode of information exchange.
Cluster fault tolerance: Provides transparent remote procedure calls based on interface methods, including multi-protocol support, as well as soft load balancing, failure tolerance, address routing, dynamic configuration and other cluster support.
Autodiscover: Based on the Registry directory service, the service consumer can dynamically check the XXX provider, make the address transparent, so that the service provider can smoothly increase or decrease the machine.
- What can Dubbo do?
1. Transparent remote method calls, just like calling a local method, call the remote method, simply configure, without any API intrusion.
2. Soft load balancing and fault tolerant mechanism, can replace F5 and other hardware load balancer in intranet, reduce cost and reduce single point.
- Service autoenrollment and discovery eliminates the need to write dead service provider addresses, the registry queries the IP address of the service provider based on the interface name, and is able to smoothly add or remove service providers.
Dubbo uses a full spring configuration, transparent access to the application, no API intrusion to the application, just load the Dubbo configuration with spring, and Dubbo the spring-based schema extension.
- Architecture of the Dubbo
The composition of the Dubbo frame is as follows:
Node role Description:
Provider: 暴露服务的服务提供方。 Consumer: 调用远程服务的服务消费方。 Registry: 服务注册与发现的注册中心。 Monitor: 统计服务的调用次调和调用时间的监控中心。 Container: 服务运行容器。
Call Relationship Description:
0 The service container is responsible for starting, loading, and running the service provider.
The service provider registers its services with the registry when it is started.
When the service consumer starts, it subscribes to the registration center for the services it needs.
The registry returns a list of service provider addresses to the consumer, and if there is a change, the registry will push the change data to the consumer based on a long connection.
Service consumers, from the provider address list, based on the soft load equalization algorithm, select one provider to make the call, if the call fails, then choose another call.
- Service consumers and providers, accumulate calls and call times in memory, and periodically send statistical data to the monitoring center every minute.
Dubbo's fault tolerance is obvious, performance has not yet to be measured, we system a page needs to be 5 times the interface, originally wanted to suggest a cache, but the business relationship can not be adopted, but also need to study the performance tuning problem of Dubbo
- Dubbo How to use
Dubbo uses a full spring configuration, transparent access to the application, no API intrusion to the application, just load the Dubbo configuration with spring, and Dubbo the spring-based schema extension. If you do not want to use the spring configuration and want to make calls through the API (not recommended), we will step through the use of Dubbo in the later chapters!
Welcome to join me in learning "build Dubbo Distributed platform", I hope you continue to pay attention to the following articles!
Introduction to building Springmvc+mybatis+dubbo distributed platform-dubbo