类 SystemRule

java.lang.Object
com.alibaba.csp.sentinel.slots.block.AbstractRule
com.alibaba.csp.sentinel.slots.system.SystemRule
所有已实现的接口:
Rule

public class SystemRule extends AbstractRule

Sentinel System Rule makes the inbound traffic and capacity meet. It takes average RT, QPS and thread count of requests into account. And it also provides a measurement of system's load, but only available on Linux.

We recommend to coordinate highestSystemLoad, qps, avgRt and maxThread to make sure your system run in safety level.

To set the threshold appropriately, performance test may be needed.

作者:
jialiang.linjl, Carpenter Lee
另请参阅:
  • 构造器详细资料

    • SystemRule

      public SystemRule()
  • 方法详细资料

    • getQps

      public double getQps()
    • setQps

      public void setQps(double qps)
      Set max total QPS. In a high concurrency condition, real passed QPS may be greater than max QPS set. The real passed QPS will nearly satisfy the following formula:
      real passed QPS = QPS set + concurrent thread number
      参数:
      qps - max total QOS, values <= 0 are special for clearing the threshold.
    • getMaxThread

      public long getMaxThread()
    • setMaxThread

      public void setMaxThread(long maxThread)
      Set max PARALLEL working thread. When concurrent thread number is greater than maxThread only maxThread will run in parallel.
      参数:
      maxThread - max parallel thread number, values <= 0 are special for clearing the threshold.
    • getAvgRt

      public long getAvgRt()
    • setAvgRt

      public void setAvgRt(long avgRt)
      Set max average RT(response time) of all passed requests.
      参数:
      avgRt - max average response time, values <= 0 are special for clearing the threshold.
    • getHighestSystemLoad

      public double getHighestSystemLoad()
    • setHighestSystemLoad

      public void setHighestSystemLoad(double highestSystemLoad)

      Set highest load. The load is not same as Linux system load, which is not sensitive enough. To calculate the load, both Linux system load, current global response time and global QPS will be considered, which means that we need to coordinate with setAvgRt(long) and setQps(double)

      Note that this parameter is only available on Unix like system.

      参数:
      highestSystemLoad - highest system load, values <= 0 are special for clearing the threshold.
      另请参阅:
    • getHighestCpuUsage

      public double getHighestCpuUsage()
      Get highest cpu usage. Cpu usage is between [0, 1]
      返回:
      highest cpu usage
    • setHighestCpuUsage

      public void setHighestCpuUsage(double highestCpuUsage)
      set highest cpu usage. Cpu usage is between [0, 1]
      参数:
      highestCpuUsage - the value to set.
    • equals

      public boolean equals(Object o)
      覆盖:
      equals 在类中 AbstractRule
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 AbstractRule
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object