Microservice Learning (2) - Microservice Framework Implementation - Introduction to Dubbo

1. Microservice implementation framework
   Currently, with the application of microservices, more and more commercial companies and open source groups develop microservice implementation frameworks. The main ones are:

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

      Because this framework has many documents and has been verified by Alibaba's internal systems and other companies, it is the preferred framework for domestic developers to learn and implement microservices.

2) Spring Cloud
     Spring Cloud is an ordered collection of a series of frameworks. It uses the development convenience of Spring Boot to subtly simplify the development of distributed system infrastructure, such as service discovery registration, configuration center, message bus, load balancing, circuit breaker, data monitoring, etc., all of which can be done in the development style of Spring Boot. to one-click launch and deployment. Spring does not repeat the manufacture of wheels, it just combines the more mature and practical service frameworks developed by various companies, and re-encapsulates the complex configuration and implementation principles through the Spring Boot style. The author has left a set of distributed system development toolkits that are easy to understand, easy to deploy and easy to maintain.

    The most famous of these frameworks is the Spring Cloud Netflix microservices framework. From the background of the project, there are quite a lot of companies using Dubbo in China, and it has a large domestic influence. Spring Cloud naturally has a large influence abroad, so this is no different. After all, there are big companies using it.

3) Dubbox
Dubbox is Dangdang's extension of Dubbo,

dubbx is Dangdang's upgrade to the original Ali dubbo2.x, and is compatible with the original dubbox. The zookeeper and spring versions have been upgraded, and restfull-style remote calls are supported.

Dubbox git address: https://github.com/dangdangdotcom/dubbox

dubbox Introduction to restfull: http://dangdangdotcom.github.io/dubbox/rest.html

-------------- -------------------------------------------------- -------------------------------------------------- --------------------------

Introduction of new features of dubbox:

support for REST style remote calls (HTTP + JSON/XML): based on very mature JBossRestEasy The framework implements REST style (HTTP + JSON/XML) remote calls in dubbo to significantly simplify the cross-language interaction within the enterprise, and at the same time significantly simplify the development of the enterprise's external Open API, wireless API and even AJAX server and so on. In fact, this REST call also allows Dubbo to provide fundamental support for today's particularly popular "microservices" architecture. In addition, the REST call also achieves relatively high performance. In the benchmark test, the gap between HTTP + JSON and the default RPC protocol of Dubbo 2.x (ie, TCP + Hessian2 binary serialization) is only about 1.5 times. See the documentation for details. Benchmark report in .

Support Java efficient serialization implementation based on Kryo and FST: Based on the well-known Kryo and FST high-performance serialization libraries, a new serialization implementation has been added to Dubbo's default RPC protocol, and its serialization system has been optimized and adjusted, which is remarkable improved the performance of Dubbo RPC, see the benchmark report in the documentation for details.

Support Jackson-based JSON serialization: Based on the industry's most widely used Jackson serialization library, a new JSON serialization implementation is added to Dubbo's default RPC protocol.

Support HTTP remoting system based on embedded Tomcat: HTTP remoting system of dubbo (ie dubbo-remoting-http) is implemented based on embedded tomcat to gradually replace the old version of embedded Jetty in Dubbo, which can significantly improve the remote control of REST and so on. Call performance and upgrade Servlet API support from 2.5 to 3.1. (Note: In addition to REST, protocols such as WebServices, Hessian, and HTTP Invoker in dubbo are all based on this HTTP remoting system).

Upgrade Spring: Upgrade Spring in dubbo from 2.x to 3.x, the most commonly used version, to reduce the trouble caused by version conflicts.

Upgrade ZooKeeper client: Upgrade the zookeeper client in dubbo to the latest version to fix bugs contained in the old version.

Supports Dubbo configuration based entirely on Java code: Based on Spring's Java Config, a completely XML-free pure Java code method is used to configure dubbo

Adjustment Demo application: Temporarily adjust and rewrite the demo application of dubbo to mainly demonstrate the REST function and the new Dubbo protocol Serialization method, Spring configuration based on Java code, etc.

Fixed dubbo bugs including configuration, serialization, management interface, etc. bugs.

Note: dubbox and dubbo 2.x are compatible, without changing any existing functions and configuration methods of dubbo (except for upgrading versions such as spring)

4) ServiceComb framework


     This framework is an open source microservice framework released by Huawei's HWCloud in June. It is configured based on Go/YAML. The deployment is very fast, and the source code size is also small. It can be easily analyzed and breakpoints on one machine. Refer to http://www.jianshu.com/p/ba432eae0a8f for details.

2. Introduction
to Dubbo 1)




Dubbo .
Provider: The service provider that exposes the service.

Consumer: The service consumer that invokes the remote service.

Registry: A registry for service registration and discovery.

Monitor: The monitoring center that counts service calls and call times.

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

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

2. When the service consumer starts, it subscribes to the registration center for the services it needs.

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

4. The service consumer, from the provider address list, selects a provider to call based on the soft load balancing algorithm, and if the call fails, selects another provider to call.

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

2) Dubbo's registration center
     The registry requires service providers and consumers to automatically register when starting and stopping. When consumers select providers, they first determine the service provider in the registry according to the cluster's selection strategy. Dubbo's registry supports Zookeeper registry, Multicast registry, Redis registry, etc. Among them, Zookeeper is more commonly used.

3) Dubbo project
Dubbo project can be downloaded at  http://dubbo.io/   , the current version is 2.5.8. The directory structure is as follows:




it can be organized by Dubbo's code (managed using Maven), and compared with the modules above. Briefly describe the situation of each package:

dubbo-common public logic module, including Util class and general model.

dubbo-remoting remote communication module, equivalent to the implementation of the Dubbo protocol, if the RPC uses the RMI protocol, this package is not required.

The dubbo-rpc remote call module, abstracting various protocols, and dynamic proxy, only includes one-to-one calls, and does not care about cluster management.

The dubbo-cluster cluster module disguises multiple service providers as one provider, including: load balancing, fault tolerance, routing, etc. The address list of the cluster can be statically configured or issued by the registry.

The dubbo-registry registry module, based on the clustering method of addresses issued by the registry, and the abstraction of various registries.

The dubbo-monitor monitoring module, which counts the number of service calls, the call time, and the service tracked by the call chain.

The dubbo-config configuration module is Dubbo's external API. Users can use Dubbo through Config to hide all the details of Dubbo.

The dubbo-container container module is a standalone container that loads Spring Boot with a simple Main, because services usually do not need the features of web containers such as Tomcat/JBoss, so there is no need to use a web container to load services.

Reference address: http://blog.csdn.net/noaman_wgs/article/details/70214612

http://dubbo.io/

http://www.jianshu.com/p/ba432eae0a8f

http://shiyanjun.cn/archives /325.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326137022&siteId=291194637