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

The differences between SpringCloud and Dubbo in springboot and what are their advantages and disadvantages

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Today, I will talk to you about the difference between SpringCloud and Dubbo in springboot and what are their respective advantages and disadvantages. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

Let's start with Nginx to understand why microservices are needed. The original service-oriented solution is to provide a unified domain name for the same service, and then the service caller sends HTTP requests to this domain, and Nginx is responsible for the distribution and redirection of the requests.

There are many problems in this architecture: as an intermediate layer, Nginx couples the logic of service invocation in the configuration file, which weakens the integrity of micro-services and makes Nginx a heavyweight ESB to some extent. The figure identifies the direction of the forwarding traffic of Nginx.

The information of the service is scattered in each system and can not be managed and maintained uniformly. Each service call is an attempt, and the service consumer does not know which instances are providing services to them. This raises some problems:

Cannot visually see the current health status and communication frequency of service providers and service consumers

Consumers' failure retransmission and load balancing do not have a unified strategy, which increases the difficulty of developing each service, which is not conducive to rapid evolution.

In order to solve the above problems, we need a ready-made central component to integrate the services and summarize the information of each service, including the component name, address, quantity, and so on.

When requesting a service, the caller of the service first obtains the instance information (IP, port, etc.) of the service through the central component, and then selects a provider of the service to access it directly through the default or custom policy, so consider introducing Dubbo.

Dubbo is an open source SOA service governance solution by Ali with rich documentation and high usage in China. Figure 2 is the basic architecture diagram of Dubbo, and the microservices built with Dubbo can solve the problems mentioned above.

From figure 2, you can see the following:

The calling middle tier becomes an optional component, and the consumer can access the service provider directly.

Service information is centralized into Registry, forming the central component of service governance.

Through the Monitor monitoring system, the statistical information of service invocation can be displayed visually.

Service consumers can make the choice of load balancing and service degradation.

But for the micro-service architecture, Dubbo is not perfect, and there are some shortcomings, such as:

Registry relies heavily on third-party components (ZooKeeper or Redis), and when something goes wrong with these components, the service invocation is quickly interrupted.

Dubbo only supports RPC calls. This creates a strong code dependency between the service provider and the caller, and the service provider needs to constantly package the Jar packet containing the common code for the consumer to use. Once there is a problem with packaging, it will cause an error in the service invocation.

The author believes that Dubbo and Spring Cloud are not completely competitive, and the problem domains solved by them are not the same.

The positioning of Dubbo is always a RPC framework, while the goal of Spring Cloud is an one-stop solution under the micro-service architecture. If you have to compare, Dubbo can be compared to Netflix OSS technology stack, while Spring Cloud integrates Netflix OSS as a distributed service governance solution, but in addition, Spring Cloud also provides distributed problem solutions such as configuration, messaging, security, call chain tracking, and so on.

Currently, due to problems such as RPC protocol and registry metadata mismatch, Dubbo and Spring Cloud can only choose one of the two when facing the selection of micro-service infrastructure, which is one of the reasons why people always compare Dubbo and Spring Cloud.

Dubbo has adapted to the Spring Cloud ecosystem, for example, as a binary communication scheme for Spring Cloud to take advantage of the performance of Dubbo, and Dubbo adapts to Spring Cloud through modularization and support for HTTP.

What's so good about Spring Cloud?

As a new generation of service framework, Spring Cloud's slogan is to develop "cloud-oriented applications", which provides more comprehensive technical support for micro-service architecture. In line with the micro-service requirements we mentioned at the beginning, see Table 1 to compare Spring Cloud with Dubbo.

Table 1 functional comparison between Spring Cloud and Dubbo

Function name DubboSpring Cloud service registry ZooKeeperSpring Cloud Netflix Eureka service invocation mode RPCREST API service gateway no Spring Cloud Netflix Zuul circuit breaker imperfect Spring Cloud Netflix Hystrix distributed configuration no Spring Cloud Config service tracking no Spring Cloud Sleuth message bus no Spring Cloud Bus data flow no Spring Cloud Stream batch task no Spring Cloud Task

Spring Cloud abandoned the RPC communication of Dubbo and adopted the REST mode based on HTTP. Strictly speaking, these two approaches have their own advantages and disadvantages. Although to some extent, the latter sacrifices the performance of service invocation, it also avoids the problems caused by the native RPC mentioned above. Moreover, REST is more flexible than RPC, and service providers and callers do not have strong code-level dependencies, which is more appropriate in a micro-service environment that emphasizes rapid evolution.

Obviously, Spring Cloud is more powerful and more extensive than Dubbo, and as a fist project of Spring, it can also be perfectly integrated with other Spring projects such as Spring Framework, Spring Boot, Spring Data, Spring Batch, and so on, which are essential for microservices.

As mentioned earlier, an important concept behind microservices is continuous integration and rapid delivery, and using a unified technical framework within services is obviously more efficient than combining decentralized technologies.

More importantly, compared to Dubbo, it is an ongoing maintenance and hotter open source project in the community, which ensures that the systems built with it will continue to be supported by open source forces.

Here are a few advantages of Spring Cloud.

Spring Cloud comes from Spring, and its quality, stability and persistence can be guaranteed.

Spirng Cloud naturally supports Spring Boot, which makes it easier for business to land.

Spring Cloud has grown very fast, from 1.x when it first came into contact with related components, to the release of 2.x series now.

Spring Cloud is the most suitable framework for microservices in the field of Java.

Compared with other frameworks, Spring Cloud has the greatest support for the surrounding environment of microservices. For small and medium-sized enterprises, the threshold for use is low.

Recommend distributed micro-service mall

After reading the above, do you have any further understanding of the differences between SpringCloud and Dubbo in springboot and their respective advantages and disadvantages? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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

Development

Wechat

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

12
Report