Java Code Examples for com.alibaba.csp.sentinel.slots.system.SystemRule#setHighestSystemLoad()

The following examples show how to use com.alibaba.csp.sentinel.slots.system.SystemRule#setHighestSystemLoad() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SystemGuardDemo.java    From Sentinel-Dashboard-Nacos with Apache License 2.0 6 votes vote down vote up
private static void initSystemRule() {
    List<SystemRule> rules = new ArrayList<SystemRule>();
    SystemRule rule = new SystemRule();
    // max load is 3
    rule.setHighestSystemLoad(3.0);
    // max cpu usage is 60%
    rule.setHighestCpuUsage(0.6);
    // max avg rt of all request is 10 ms
    rule.setAvgRt(10);
    // max total qps is 20
    rule.setQps(20);
    // max parallel working thread is 10
    rule.setMaxThread(10);

    rules.add(rule);
    SystemRuleManager.loadRules(Collections.singletonList(rule));
}
 
Example 2
Source File: SystemGuardDemo.java    From Sentinel with Apache License 2.0 6 votes vote down vote up
private static void initSystemRule() {
    List<SystemRule> rules = new ArrayList<SystemRule>();
    SystemRule rule = new SystemRule();
    // max load is 3
    rule.setHighestSystemLoad(3.0);
    // max cpu usage is 60%
    rule.setHighestCpuUsage(0.6);
    // max avg rt of all request is 10 ms
    rule.setAvgRt(10);
    // max total qps is 20
    rule.setQps(20);
    // max parallel working thread is 10
    rule.setMaxThread(10);

    rules.add(rule);
    SystemRuleManager.loadRules(Collections.singletonList(rule));
}
 
Example 3
Source File: SystemRuleEntity.java    From Sentinel-Dashboard-Nacos with Apache License 2.0 5 votes vote down vote up
@Override
public SystemRule toRule() {
    SystemRule rule = new SystemRule();
    rule.setHighestSystemLoad(avgLoad);
    rule.setAvgRt(avgRt);
    rule.setMaxThread(maxThread);
    rule.setQps(qps);
    return rule;
}
 
Example 4
Source File: SystemRuleEntity.java    From Sentinel with Apache License 2.0 5 votes vote down vote up
@Override
public SystemRule toRule() {
    SystemRule rule = new SystemRule();
    rule.setHighestSystemLoad(highestSystemLoad);
    rule.setAvgRt(avgRt);
    rule.setMaxThread(maxThread);
    rule.setQps(qps);
    rule.setHighestCpuUsage(highestCpuUsage);
    return rule;
}