Building the dubbo distributed platform-dubbo usage scenario and the usage of



With the development of the Internet, the scale of the website application is expanding, the conventional vertical application architecture can not cope, the distributed service architecture And the mobile computing architecture is imperative, and a governance system is needed to ensure an orderly evolution of the architecture.

About the use of dubbo, this will start from the evolution of the system, since the use of dubbo is mostly in the e-commerce system, then start from the evolution of the e-commerce system.

A simple e-commerce website says it may contain the following modules and features, such as the home page, detail page, list page, order page, payment page, and background management. A single system architecture makes more and more resources are used in the development process, and it becomes more and more difficult to maintain as the traffic increases.

于一一一一立应用结构, vertical application architecture solves the expansion problem faced by a single application architecture, traffic can be dispersed among various subsystems, and the volume of the system is controllable, which reduces the developer's The cost of collaboration and maintenance improves development efficiency. However, the same logic code in the vertical architecture needs to be copied continuously and cannot be reused. So the distributed system came into being.

The public logic business is extracted to form a service and provided externally. In this way, maintenance and upgrades only need to be divided into one small system to maintain, and the front-end business system can be separated from the underlying data access, and the division of labor is more clear. The infrastructure that

distributed systems depends on includes service frameworks, messaging middleware, data access middleware, configuration centers, distributed caching systems, persistent storage (relational databases, nosql databases), search engines, CDN networks, Load balancing system, operation and maintenance automation system, hardware virtualization and image management system, distributed file system, log collection system, monitoring system, offline computing, real-time computing, data warehouse, etc. With the further development of service, more and more services, calls and dependencies between services are becoming more and more complex, and a service-oriented architecture (SOA) has been born, which has led to a series of corresponding technologies. Such as service framework for service provisioning, service invocation, connection processing, communication protocol, serialization mode, service discovery, service routing, log output, etc.

This is the service governance framework for distributed systems, and dubbo is also created. In the architecture of the entire distributed system, dubbo is structured according to a layered architecture, so that the maximum degree of loose coupling between the various levels.


单应用结构When the website traffic is very small, only one application is needed. Deploy all features together to reduce deployment nodes and costs. At this point, the Data Access Framework (ORM) used to simplify the workload of additions, deletions, and changes is key.

垂直应用结构When the number of visits is gradually increasing, the acceleration of the single application increases the machine is getting smaller and smaller, and the application is split into several applications that are not related to each other to improve efficiency. At this point, the Web Framework (MVC) for speeding up front-end page development is key.

Distributed Service ArchitectureWhen more and more vertical applications are used, interaction between applications is inevitable, core business is extracted, and as a stand-alone service, a stable service center is gradually formed, making front-end applications faster. Responsive to changing market demands. At this point, the Distributed Service Framework (RPC) for improving business reuse and consolidation is key. 流计算结构As more and more services, capacity assessment, waste of small service resources and other issues gradually emerge, at this time need to add a dispatch center based on access pressure to manage cluster capacity in real time, improve cluster utilization . At this point, the Resource Scheduling and Governance Center (SOA), which is used to increase machine utilization, is key.


Before large-scale service, the application may simply expose and reference the remote service through tools such as RMI or Hessian, call it by configuring the URL address of the service, and load balance through hardware such as F5.

When the service is getting more and more, the service URL configuration management becomes very difficult, and the single point pressure of the F5 hardware load balancer is getting bigger and bigger. A service registry, dynamic registration and discovery service is required to make the location of the service transparent. Soft load balancing and Failover are achieved by obtaining a list of service provider addresses on the consumer side, reducing the reliance on the F5 hardware load balancer and reducing some of the cost.

When further development, the dependencies between services become complicated and even unclear which application should be started before which application, the architect can not fully describe the architectural relationship of the application. At this time, you need to automatically draw the dependency graph between the applications to help the architect to clean up the relationship.

Then, the call volume of the service is getting bigger and bigger, and the capacity problem of the service is exposed. How much machine support does the service need? When should I add a machine? In order to solve these problems, the first step is to count the daily call volume and response time of the service as a reference indicator for capacity planning. Secondly, it is necessary to dynamically adjust the weights. On the line, the weight of a certain machine is always increased, and the change of response time is recorded in the process of increasing, until the response time reaches the threshold, and the amount of visits at this time is recorded, and then Multiply the number of visits by the number of machines to reverse the total capacity.