当前位置: 首页 > 文档资料 > Sentinel 中文文档 >

Cluster Flow Control

优质
小牛编辑
127浏览
2023-12-01

Introduction

Cluster flow control is useful in plenty of scenarios. For example:

  • There are 50 instances in the service cluster, and you're going to limit the frequency of one invocation to 10 per second in total.
  • The traffic towards each instance might be uneven, so if we set local flow rules, requests might be blocked when specific instances are targeted with large traffic, while the total QPS has not reached the threshold sum.

clustr-token-server-overview

Cluster Flow Rule

In FlowRule:

private boolean clusterMode; // whether to enable the cluster mode
private ClusterFlowConfig clusterConfig; // items about the cluster flow control

In ClusterFlowConfig:

// Required and unique. Usually assigned by the dashboard
private Long flowId;

// Threshold type. 0 for average threshold (per instance), 1 for global threshold.
private int thresholdType = ClusterRuleConstant.FLOW_THRESHOLD_AVG_LOCAL;

// Whether to fallback to local flow control if the transport between token client and server failed
private boolean fallbackToLocalWhenFail = true;