Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What can Dubbo bring?

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "what can Dubbo bring". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Preface

With the development of the Internet industry, more and more open source technologies such as frameworks, middleware and containers continue to emerge to better serve the business, achieve business and solve problems. However, in the face of so many technology choices, how can we identify the technologies that are suitable for our team's business? For people, shoes are too large, may affect the running speed, shoes are too small, may affect the growth of the body. The same is true of technology for business.

Therefore, compared with the skills of learning, building, using, operation and maintenance of technology, our choice of technology discrimination is more important. So how does the Dubbox framework to be discussed in this article stand out among many service frameworks and be selected by the team to implement the service path?

two。 Service 2.1 Why do you want to serve

Technology is created for business, and architecture is also created for business. With the development of business and the growth of the number of users, the number of systems increases, and the call dependency relationship becomes more complex. In order to ensure the requirements of high availability and high concurrency of the system, the architecture of the system is also slowly transferred from the single era to the service SOA era. According to the different requirements of different services for system resources, we can configure system resources more reasonably and maximize the utilization of system resources.

Single application architecture when website traffic is very small, only one application is needed to deploy all functions together to reduce deployment nodes and costs. At this point, the data access framework (ORM), which is used to simplify the workload of additions, deletions and modifications, is the key.

Vertical application architecture when the number of visits increases gradually, the acceleration caused by a single application increasing machine is getting smaller and smaller, and the application is divided into several unrelated applications to improve efficiency. At this point, the Web framework (MVC) used to accelerate front-end page development is the key.

Distributed service architecture when there are more and more vertical applications, the interaction between applications is inevitable, extract the core business, as an independent service, gradually form a stable service center, so that the front-end applications can respond to the changing market demand more quickly. At this point, the distributed service framework (RPC) for improving business reuse and integration is the key.

In mobile computing architecture, when there are more and more services, capacity evaluation, waste of small service resources and other problems gradually appear, it is necessary to add a scheduling center to manage cluster capacity in real time based on access pressure to improve cluster utilization. At this point, the resource scheduling and governance center (SOA) used to improve machine utilization is the key.

With the development of the business, the platform can meet the business needs from the All in One environment (in the case of Java, it may only be solved by one or two war packages), and it needs to split multiple applications and separate the front and back ends by MVC, so as to speed up the development efficiency. With the development of more and more services, some core or shared services have to be split out to provide real-time flow monitoring computing. In fact, at this stage, if the service is split fine enough and runs independently, it can at least be understood as SOA (Service Oriented Architecture Service-oriented Architecture) architecture.

2.2 challenges posed by servic

When ushering in the era of service SOA, we will face many problems to be solved, such as the increase of system complexity, service dependency, service performance monitoring, full-link log, disaster recovery, circuit breaker, current restriction and so on. So why do you want to do distributed services in the face of these problems? Because only when we move forward in the future can we go higher and farther. However, do not be discouraged to see these problems, regardless of these problems, let us step by step to sort out the existing problems, what goals we want to achieve, the problem will naturally be easily solved.

Based on the current business system of the team, first of all, we need to sort out what the existing problems are:

Multiple transfer modes: HTTP, WebService

Service invocation dependencies: manual recording, viewing code analysis

Service invocation performance monitoring: logging, manual viewing time

Service and application are tightly coupled: the service is down and the application is not available

Service cluster load configuration: Nginx configuration, there is a single point of problem

When choosing a technical framework, the technical framework is basically to solve the above existing problems, and we also need to identify our expectations and goals to achieve:

Support current business requirements, which is the most basic condition

Service avoids single point problem and is decentralized

High service availability, high concurrency, and decoupling service dependency

Service generalization to support heterogeneous system invocation of services

Service dependency self-maintenance, visualization

Service performance monitoring self-statistics, visualization

Services need to have their own features such as registration, discovery, health check, load balancing, etc.

Developers have the advantages of high attention, quick use, simple and light weight, and low intrusion.

There is also the most important point, which is often a misunderstanding entered by many technicians, "for technology, do not use it for use, it is the right way to solve the problem with the simplest and appropriate technology." The architecture serves the business, and the architecture that can quickly and easily meet the business needs is a good architecture.

2.3 Future Trends in Services

When it comes to services, many of you may have heard of the concepts and terms of SOA, MSA and other services. In recent years, MSA has become more popular. In fact, different problems are being solved behind each concept. The most important feature of this kind of noun is that it is easy to understand as soon as it is explained, not to know when asked, and to fight when it is discussed.

In the final analysis, both SOA and MSA are architectural designs that provide interfaces to the outside world. I think micro-service is actually with the development of the Internet, complex platforms, the emergence of business, leading to the SOA architecture to a finer-grained, more universal degree of development, has become the so-called micro-service. Based on this statement, I think the difference between SOA and microservices lies in the following aspects:

Compared with SOA, micro-services are more elaborate. Micro-services exist as independent processes and have no influence on each other.

Microservices provide more universal interfaces, such as HTTP RESTful, which can be called by all kinds of terminals, regardless of language and platform restrictions.

Microservices tend to be deployed in a distributed and decentralized manner, which is more suitable for Internet business scenarios.

Microservices have a lot in common with SOA. Both of them are typical system structures containing loosely coupled distributed components. Microservices provide a clearer and better defined way to create an architecture around the concept of services. The principle of micro-service is highly consistent with the idea of agile software development, and its evolution goal is the same as that of SOA principle, which reduces the high complexity of traditional enterprise service bus development. The most critical difference between the two is that microservices focus on generating value in an autonomous way. But the intention behind the two architectures is different: SOA attempts to integrate applications, generally using a central management model to ensure that applications can interact with each other. Microservices try to deploy new features to expand the development team quickly and efficiently. It focuses on decentralized management, code reuse and automated execution.

Functional SOA micro service components large chunks of business logic individual tasks or small chunks of business logic coupling is usually loosely coupled company architecture any type of small, cross-functional team management focuses on central management, decentralized management objectives to ensure that applications can interoperate to implement new functions, rapidly expand the development team

Microservice is not a new way of thinking. It is more like a refinement of ideas, a refined evolution of SOA, and makes better use of advanced technologies to solve problems, such as containers and automation. Therefore, for us to choose the service technology framework, it is not black and white, but for SOA, MSA architecture design at the same time to consider compatibility, for the existing platform architecture design, retreat then defend SOA, advance attack MSA, phased selection is suitable.

3. Frame

At present, there are many mature service frameworks in the industry, such as Hessian, CXF, Dubbo, Dubbox, Spring Cloud, gRPC, thrift and other technology implementations, all of which can be called remotely. The specific technical implementation advantages and disadvantages refer to the following analysis, which is also an important basis in the process of technology scheme selection.

3.1 comparison of service frameworks

Dubbo is a Java high-performance and excellent service framework opened by Alibaba Company, 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. However, it is slightly regrettable that it is said that within Taobao, dubbo competes with HSF (not open source), another similar framework on Taobao, resulting in the disbanding of the dubbo team. Instead, Dubbox, an extended version of Dangdang, continues to develop and blossoms inside and outside the wall. Some other well-known e-commerce companies such as Dangdang and Gome have maintained their branches or basic development in dubbo, but the official libraries are lack of maintenance, and related dependent classes such as Spring,Netty are still very old versions (Spring 3.2.16.RELEASE, netty 3.2.5.Final). However, some netizens have written plug-ins to upgrade Spring and Netty.

There is no difference between Dubbox and Dubbo in nature, the meaning of the name extends Dubbo only, and the following extended functions are also very important to choose Dubbox.

Support REST style remote calls (HTTP + JSON/XML)

Support efficient serialization implementation of Java based on Kryo and FST

Support for Jackson-based JSON serialization

Support HTTP remoting architecture based on embedded Tomcat

Upgrade Spring to 3.x

Upgrade ZooKeeper client

Support for Dubbo configuration based entirely on Java code

Spring Cloud, which is based entirely on Spring Boot, is a very new project. Release version 1.0 was launched in 2016 and is currently updated very quickly on Github. Although Spring Cloud time is the shortest, compared with RPC frameworks such as Dubbo, Spring Cloud provides a full range of distributed system solutions. Spring Cloud provides developers with tools to quickly build in distributed systems (configuration management, service discovery, circuit breakers, routing, micro-agents, control bus, one-time token, global trivial, leader election, distributed session, cluster status). Developers using Spring Cloud can quickly start services or build applications. They will work in any distributed environment, including developers' own laptops, data centers for bare physical machines, and cloud management platforms like Cloud Foundry. Lead the development of this micro-service architecture in the future, and provide a set of industry-standard micro-service architecture solutions.

The disadvantage is that the project is very young, it is rare to see people in the domestic industry use a complete set of production, generally only one or two components. Most of the relevant technical documents are in English, and there are relatively few cases, so it takes longer to explore if you use it.

The following figure shows a comparison between Spring Cloud and Dubbo:

Motan is an open source Java framework for Sina Weibo. It was born relatively late, starting in 2013 and open source in May 2016. Motan has been widely used in Weibo platform, completing nearly hundreds of billions of calls for hundreds of services every day. Compared with Dubbo, Motan is not so comprehensive in terms of functionality and does not implement many extensions. The number of users is relatively small, and the function and stability remain to be seen. Poor support for cross-language calls, mainly supporting java.

Hessian uses the binary RPC protocol, which is suitable for sending binary data. But it is also a Web Service framework to support RPC calls, which is simple in function and easy to use. The transmission is based on Http protocol. Remote services are provided through Servlet. The request is initiated through the API provided by Hessain itself. The responder accepts the request according to the API provided by Hessian.

Advantages of Hessian:

The whole jar is very small and lightweight.

Simple configuration

Powerful, leaving aside soap (simple object access protocal simple object access Protocol) and ejb, using binary to transfer objects

Rpcx is the Dubbo of Go ecosphere, which is lighter than Dubbo and implements many features of Dubbo. With the excellent concurrency and concise syntax of Go language, distributed RPC services can be implemented with less code.

GRPC is a high-performance, general open source RPC framework developed by Google. It is mainly developed by Google for mobile applications and is designed based on HTTP/2 protocol standards. It is developed based on ProtoBuf (Protocol Buffers) serialization protocol, and supports many development languages. In itself, it is not distributed, so further development is needed to achieve the functions of the above framework.

Thrift is a cross-language high-performance service framework of Apache, and it has also been widely used.

Comparison of the functions of the above RPC framework:

Functional HessianMontanrpcxgRPCThriftDubboDubboxSpring Cloud development language cross-language JavaGo cross-language JavaJavaJava distributed (service governance) × √√ × × √√√ multi-serialization framework supports hessian √ (supports Hessian2, Json Scalable) √ × only supports protobuf) × (thrift format) √√√ multiple registries × √√ × × √√√ Management Center × √√ × × √√√ Cross-programming language √ × (support php client and C server) × √√ × × support REST × × × √√ low, middle and high school, low difficulty, low, medium and low cost of operation and maintenance, low, medium, low, medium, low, open source organization CauchoWeiboApacheGoogleApacheAlibabaDangdangApache

Choices in the actual scene

Spring Cloud:Spring family bucket, very comfortable to use, only you can not imagine, can not be done without it. Unfortunately, because of the late release, there are no more successful cases in China, and most of them are testing the water, but after all, it is better to have Spring as an endorsement.

Dubbox: compared to Dubbo supporting REST, it is estimated to be one of the important reasons why many companies choose Dubbox. However, if you use Dubbo's RPC call method, there will still be strong API dependencies among services, each with its own advantages and disadvantages.

Thrift: if you are aloof, you can create an abstract custom framework based on Thrift.

Montan: probably because it came out late, except for the one released by Sina Weibo in early 16 years.

Hessian: if it is a start-up company or the number of systems has not exceeded 5, it is recommended to choose this one. After all, it is relatively light and simple in terms of development speed, operation and maintenance cost, and difficulty to get started. Even if you migrate to SOA later, it will be seamless.

Rpcx/gRPC: if there is no serious performance problem with the service, or the technology stack has not changed, it may not be introduced all the time, and even if it is introduced, it will only optimize the use of a small number of modules.

3.2 RPC vs REST (JAX-RS)

Because Dubbo is the basic framework, whether the content of its implementation is reasonable for us to implement the micro-service architecture, we also need to consider whether to modify it according to our own needs. For example, the service call of Dubbo is implemented through RPC, but if we carefully read the article microservices of Martin Fowler, the communication between services is defined as the REST API of HTTP protocol. So what's the difference between the two?

The interface between the service provider and the caller is too dependent

We define our own service abstract interface for each microservice and publish it to a private repository through continuous integration. The caller's application has a strong dependency on the abstract interface provided by the microservice, so the development, testing and integration environment all need to strictly manage version dependency, so that a series of problems such as inconsistency between the server and the caller will not occur, such as the application can not be compiled successfully. And this will also directly affect the environmental requirements of local development, often an upper-level application that relies on a lot of services, has to update a lot of code and install every day before subsequent development. Without a strict version management system or developing some automated tools, such dependencies can be a nightmare for the development team. The REST interface is lighter than RPC, and the dependencies of service providers and callers only rely on a contract, and there is no strong dependence at the code level. Of course, the REST interface also has pain points, because the definition of the interface is too light, which can easily lead to the problem of service integration due to the inconsistency between the definition document and the actual implementation. But this problem is easy to solve. You only need to integrate the swagger through each service and integrate the code and document of each service. It can be solved. Therefore, in the distributed environment, the service dependency of REST is more flexible than that of RPC.

Services are platform-sensitive and difficult to simply reuse

Usually, when we provide external services, we will provide them in the way of REST, so that we can achieve cross-platform characteristics, and callers of any language can implement them according to the definition of interfaces. So when we want to provide REST interface in Dubbo, we have to implement a layer of proxy, which is used to convert RPC interface into REST interface for external publication. If each service itself exists in the form of REST interface, when we want to provide services, we can mainly configure mapping and permission control in the API gateway to realize the reuse of services.

It is believed that these pain points are also one of the reasons why Dangdang has added REST support to dubbox (an open source extension based on Dubbo).

Dubbo implements the foundation of service governance, but in order to complete a complete micro-service architecture, we still need to expand and improve in all aspects to ensure the health of the cluster, so as to reduce the increased pressure on development, testing, and operation and maintenance. Only in this way can the personnel of each link really focus on business logic.

And Spring Cloud still carries forward the style of Spring Source to integrate everything, kneads some mature products and frameworks of micro-service architecture into one with a standardized attitude, and inherits the characteristics of simple configuration, rapid development and easy deployment of Spring Boot, making the original complex architecture work relatively easy to use. Therefore, if you choose Dubbo, be sure to prepare the whole solution in all aspects, otherwise it is likely that as the number of services grows, the whole team will struggle to cope with various architectural deficiencies. If you choose Spring Cloud, relatively speaking, each link already has corresponding component support, some may not be able to meet all your needs, but its active community and high-speed iterative progress will also be a strong backing you can rely on.

4. What does Dubbox bring? 4.1 Dubbo service governance

Feature description transparent remote invocation calls remote methods just like calling local methods; simple configuration without any API intrusion; load balancing mechanism client-side LB, which can replace hardware load balancers such as F5 in the intranet; fault-tolerant retry mechanism to serve Mock data, number of retries, timeout mechanism, etc. The automatic registration discovery registry queries the IP address of the service provider based on the interface name, and can smoothly add or delete service providers; performance log monitors the monitoring center of Monitor service invocation and call time; service governance center routing rules, dynamic configuration, service degradation, access control, weight adjustment, load balancing, and other manual configuration. No automatic governance center, such as fuse current limiting mechanism, automatic weight adjustment, etc. 4.2 Dubbox expansion features

Support REST style remote calls (HTTP + JSON/XML)

Support efficient serialization implementation of Java based on Kryo and FST

Support for Jackson-based JSON serialization

Support HTTP remoting architecture based on embedded Tomcat

Upgrade Spring to 3.x

Upgrade ZooKeeper client

Support for Dubbo configuration based entirely on Java code

This is the end of the content of "what can Dubbo bring". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report