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.
SystemRuleManager| Constructor and Description |
|---|
SystemRule() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
long |
getAvgRt() |
double |
getHighestCpuUsage()
Get highest cpu usage.
|
double |
getHighestSystemLoad() |
long |
getMaxThread() |
double |
getQps() |
int |
hashCode() |
boolean |
passCheck(Context context,
DefaultNode node,
int count,
Object... args)
Check whether current statistical indicators meet this rule, which means not exceeding any threshold.
|
void |
setAvgRt(long avgRt)
Set max average RT(response time) of all passed requests.
|
void |
setHighestCpuUsage(double highestCpuUsage)
set highest cpu usage.
|
void |
setHighestSystemLoad(double highestSystemLoad)
Set highest load.
|
void |
setMaxThread(long maxThread)
Set max PARALLEL working thread.
|
void |
setQps(double qps)
Set max total QPS.
|
String |
toString() |
as, getLimitApp, getResource, setLimitApp, setResourcepublic double getQps()
public void setQps(double qps)
real passed QPS = QPS set + concurrent thread number
qps - max total QOS, values <= 0 are special for clearing the threshold.public long getMaxThread()
public void setMaxThread(long maxThread)
maxThread only
maxThread will run in parallel.maxThread - max parallel thread number, values <= 0 are special for clearing the threshold.public long getAvgRt()
public void setAvgRt(long avgRt)
avgRt - max average response time, values <= 0 are special for clearing the threshold.public double getHighestSystemLoad()
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.SystemRuleManagerpublic double getHighestCpuUsage()
public void setHighestCpuUsage(double highestCpuUsage)
highestCpuUsage - the value to set.public boolean passCheck(Context context, DefaultNode node, int count, Object... args)
Rulepublic boolean equals(Object o)
equals in class AbstractRulepublic int hashCode()
hashCode in class AbstractRuleCopyright © 2019 Alibaba Group. All rights reserved.