What’s the difference between Dubbo and Spring Cloud?

Dubbo started out as an extensible RPC call framework. The service routing, load balancing, serialization mechanism, network transport protocol, and so on involved in a call in Dubbo can be extended, depending on the component you choose, and Spring Cloud is similar. So we can’t compare the two frameworks in terms of performance.

Second, as a framework, we should also compare the scalability of this framework, Dubbo’s scalability is no better than Spring Cloud. The current advantage of Spring Cloud is that it has complete components, such as service gateway, distributed configuration center, service tracking, etc., which Dubbo does not have yet, but is ready to add in the Dubbo ecosystem.


What’s new in Dubbo 2.7?

1. Dynamic Configuration Center

2. Metadata center

3. Conditional routing supports applications

4. Label route


Which communication protocols are supported by Dubbo and which scenarios are applicable to different protocols

1. Dubbo ://, the default protocol of the framework, using a single long connection and NIO asynchronous communication, suitable for small amount of data and large concurrent service invocation.

2. http://is used for synchronous transmission using short connection. The amount of data used is uncertain and needs to be used in JS or browser.


Http long connection and short connection

Http1.0 does not cause long connections

Http1.1, default is long Connection, Connection=keep-alive

However, it is not accurate to say that Http is a long connection, because Http is an application layer protocol, TCP is a transport layer protocol, and only the transport layer can say that the connection is established and closed.

So, what’s the advantage of a long connection, a long connection is that it stays connected, so when I open a web page, it actually takes me a while before I can ask for something else, and I don’t really need the connection to stay there all the time, so from that point of view, it seems appropriate to use a short connection.

Long connection, in fact, refers to TCP long connection, so HTTP can send multiple HTTP requests and receive multiple HTTP responses on the basis of this connection. In fact, when we open a web page, we also need to request a lot of JS, CSS and other resources, this time these requests can be reused TCP connection, thus saving network resources.

So, when do long connections close? If there is a timeout period, set this parameter in header. If there is no HTTP request within this period, this parameter is automatically closed.


Cluster fault tolerance scheme supported by Dubbo




1. Failover Cluster: The system automatically switches over to other servers when a failure occurs. Typically used for read operations, but retries introduce longer delays.

2. Failfast Cluster: Fails quickly. An error message is reported immediately after a failure. Typically used for non-idempotent writes, such as new records.

3. Failsafe Cluster: Indicates Failsafe security. If an exception occurs, ignore it. It is used to write audit logs.

4. Failback Cluster: The system automatically recovers from failures. Failed requests are recorded in the background and resent periodically. Typically used for message notification operations.

5. Forking Cluster: Call multiple servers in parallel and return if one is successful. It is usually used for read operations that require high real-time performance but waste more service resources

6. Broadcast Cluster: Broadcast calls all providers one by one. An error is reported if any provider fails. Typically used to notify all providers to update local resource information such as caches or logs.


Load balancing policies supported by Dubbo

1. Random LoadBalance: indicates Random LoadBalance

2. RoundRobin LoadBalance: polling

3. LeastActive LoadBalance: indicates the minimum number of active calls

4. ConsistentHash LoadBalance: ConsistentHash, in which requests with the same parameters are always sent to the same provider.


How is service degradation implemented in Dubbo

Mock =fail:return+ NULL When a service fails to be invoked, Mock =fail:return+ NULL returns null when a service fails to be invoked.


What is the mechanism by which service providers can implement fail-kick?

Service failure Kicks out temporary zooKeeper-based nodes.


Dubbo service exposure process

Dubbo first parses the Dubbo: Service/label through the DubboNamespanceHandler, and Spring completes instantiation of the Bean, then issues the ContextRefreshEvent event, The Export method in ServiceBean is called, with this method as the entry point and service exposure. Poetry, we should call service export, because service export including service registration and service exposure, the export order also registered again for service exposure to service, the service registry is to service information (including the interface name, and for the information such as the agreement) to register to the registry, and service information listener binding, Service exposure (essentially, starting tomcat or nettyserver) is then performed.


Dubbo service introduction process




Dubbo first parses the Dubbo: Reference/label through the DubboNamespanceHandler, and Spring instantiates the Bean, calling the getObject method of the ReferenceBean when the Bean is introduced. Take this method as the entrance and then carry out service introduction. The steps of service introduction are as follows: first find all service providers from the registry according to the service name and encapsulate them into the service directory, and then carry out the initial service route

, then listener binding, then encapsulating the service directory as a Cluster, and finally generating proxy classes. In fact, service introduction is quite complex and can only be outlined here.


Process of Dubbo service invocation

Consumer:

1. The Mock mechanism

2. Service routes

3. Load balancing

4. The Filter to Filter

5. Send the request

Server:

1. Receive the request

2. The Filter to Filter

3. Implement concrete implementation classes

4. Return the result

This article gives you a thorough understanding of the underlying principles of Dubbo

  1. Feel good friends can forward this article to pay attention to small;
  2. Thank you for your support!