Dubbo connection model and why

Insert picture description here
The four roles of Dubbo are service provider, service consumer, registration center, and monitoring center.

Provider Consumer Registry is connected in pairs and both are long connections, while the connection between Consumer Provider and Monitor is short. Why is this connection model?

answer:

  1. Why are there long connections between Consumer Providers?
    Consumer Provider is connected between a single long connection . Why is it so designed? First of all, we need to understand that multiple connections can be established between two processes, because one process can bind multiple ports. So, what is the difference between a single connection and multiple connections for communication between the two processes? The difference is that in the case of multiple connections, the client process can generate a larger amount of instantaneous data to the server. In the extreme case, one Consumer can do it. Fully squeeze a Provider's network card. For a single connection, data transmission must be queued. Assuming that the maximum data flow of a connection is 7M/s, a Provider with a gigabit network card can provide services to 20 consumers at the same time. The disadvantage is that the optimal speed may not be as good as multiple connections. Combined with the facts, there are often more consumers than service providers , so a single connection is used. So why is it a long connection ? Avoid frequent establishment and destruction of connections in high concurrency situations, which wastes performance.
  2. Why are there long connections between Consumer Registry?
    The current understanding is this. Consumers need to be notified when the data in the registry is activated. For example, a new P goes online. If there is no long connection between R and C, then R cannot confirm the life state of C, and then it fails to notify. The situation is sometimes daunting.
  3. Why are there long connections between Provider Registry?
    It stands to reason that there is a long connection between C and P. Then, through the heartbeat, once P goes offline, C can detect it, so why does the registry still have a long connection with P? For existing P and C, the registration center monitors P through a long connection with P, and then notifies the corresponding C, which seems a bit redundant. But if a new C goes online later, the registry needs to inform the new C about the latest P node, so the registry still needs to maintain a long connection with P to monitor the activity.
  4. Why is there a short connection between Consumer Provider and Monitor?
    C and P record call-related data in the memory through the Filter, and report it to the Monitor every minute. The time interval is long, so it is a short connection.

Guess you like

Origin blog.csdn.net/qq_41634872/article/details/110988054