Sentinel cluster flow control principle

If the service call uses rotation training or random routing, Theoretically, you can set flow control rules on each single machine (single machine QPS upper limit = total QPS upper limit / number of machines). Cluster flow control can solve the problem of uneven traffic distribution, resulting in poor overall flow control effect. It can accurately control the total calls of the whole cluster. Combined with single machine flow limit, it can give better play to the effect of flow control. However, it will communicate with the server, so there will be a certain loss in performance.

Cluster flow control has two identities:

Sentinel 1.4. 0 has introduced the cluster flow control module, which mainly includes the following parts:

After a general understanding of the concept of cluster flow control, let's analyze the cluster flow control rules and the respective processing mechanisms of the client and server~

Cluster flow control rules

Two fields are added to flowrule for cluster current limiting configuration, as shown below. Clustermode is in the method flowrulechecker Canpasscheck will be used to judge whether it is cluster flow control. False indicates single machine flow control; True indicates cluster flow control. The method passclustercheck will be called to communicate with the cluster flow control server to determine whether flow control has been triggered. At this time, the exception degradation strategy is local flow control (when the fallbacktolocalorpass method and fallbacktolocalwhenfail attribute are true, execute local flow control, otherwise directly return to true without flow control check).

Client side processing mechanism

The processing mechanism of the client side is the same as that of the single machine, except that the clustermode and clusterconfig attributes are configured. For specific client use, please refer to the official document cluster flow control, which will not be repeated here. In the case of cluster flow control, it can be found in flowrulechecker The method passclustercheck will be called in the canpasscheck method, as follows:

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>