“This is the 15th day of my participation in the First Challenge 2022. For details: First Challenge 2022”
Simultaneous answer, concord.
preface
Dubbo is a java-based high-performance RPC distributed service framework, which is widely used in distributed applications. Even in the current springCloud system, Dubbo still occupies a place. Today we are going to share some common interview questions about the differences and connections between Dubbo and SpringCloud.
dubbo
Talking about Dubbo, you can’t get around the following picture:
- 1 start: Dubbo’s service provider is automatically started when the Spring container is started.
- 2 Register: After the dubbo service provider is started, it registers the content, including the IP address, port, interface list (interface classes and methods), version, and communication protocol.
- 3 SUBSCRIBE, when the subscriber consumer starts, it will automatically go to Registry to obtain the registered service information.
- 4 Notify: When the registry detects that the registration information of the provider changes, the Register actively pushes messages to consumers.
- 5 invoke, consumer invokes a method that calls privider synchronously and waits for the result to return.
- The provider and consumer automatically send call statistics to the monitor every two minutes.
The application scenario of Dubbo is as follows:
springcloud
The classic picture of SpringCloud is shown below. We know that there is a CAP theory in distributed systems, where the registry SpringCloud uses EUreka to guarantee AP, and springCloud provides a complete set of solutions. It’s not just a few features like Dubbo.
Springcloud architecture diagram of each component as shown below, here is a ecological system, including the gateway, load balancing, service management, registration center, link tracking, configuration, and other components, all components are can be set up with the way, rather than on the server build a wide range of services like dubbo, For example, zk, dubboadmin, etc. :
Similarities and differences between Dubbo and SpringCloud
Springcloud is not a development framework, but a complete set of solutions, while Dubbo is just a framework for RPC.
- 1 Dubbo uses the transport layer TCP protocol, which is binary transmission and consumes less bandwidth. Serialization uses the serialization protocol of JDK. Springcloud uses THE HTTP protocol at the application layer, which consumes a lot of bandwidth. In addition, SpringCloud uses JSON packet transmission, which consumes a lot of bandwidth.
- The 2 dubbo calls use long links, which are suitable for transferring small packets, while for springcloud they are short links, which are suitable for transferring large amounts of information, such as images, text and so on.
- 3 Dubbo development needs to rely on JAR packages, and the dependency management is complicated. The interface protocol of SpringCloud is relatively loose and not very restrictive.
- 4. The differences in service functions provided by Dubbo and SpringCloud are shown in the following figure:
- Dubbo uses ZK by default, while SpringCloud uses Eureka. The former guarantees CP, while the latter guarantees AP. However, with the emergence of SpringCloud Alibaba, It also introduced artifacts such as NACos, which doubles as a registry and configuration center.
conclusion
This article briefly introduces the relationship and differences between Dubbo and SpringCloud. Dubbo, as an RPC framework, still plays an important role after technical iterations, because not all business scenarios require a high profile SpringCloud package solution with a solid grasp of mature technology. Keep up with new technology and broaden your horizons is the most important thing.