Jmeter-如何获取SLA度量

Jmeter-如何获取SLA度量,jmeter,jmeter-plugins,Jmeter,Jmeter Plugins,是否存在从UI计算jmeter中SLA下的请求数的方法?例如,响应时间

是否存在从UI计算jmeter中SLA下的请求数的方法?例如,响应时间<400毫秒的请求计数

  • 最简单的解决方案是将标签、运行时间和/或延迟保存到CSV文件,该文件将生成如下原始输出:

    elapsed,label
    423,sampler1
    452,sampler2
    958,sampler1
    152,sampler1
    
    long responseTime = sampleResult.getEndTime() - sampleResult.getStartTime();
    if(responseTime < 400) {
        FileOutputStream f = new FileOutputStream("myreport.csv", true);
        PrintStream p = new PrintStream(f);
        this.interpreter.setOut(p); 
        print(sampleResult.getSampleLabel() + "," + responseTime);
        f.close(); 
    }
    
    从这里,您可以将其带到任何其他工具(awk、Excel等)以筛选所需的结果

  • 另一种选择是使用动态生成此类报告。大概是这样的:

    elapsed,label
    423,sampler1
    452,sampler2
    958,sampler1
    152,sampler1
    
    long responseTime = sampleResult.getEndTime() - sampleResult.getStartTime();
    if(responseTime < 400) {
        FileOutputStream f = new FileOutputStream("myreport.csv", true);
        PrintStream p = new PrintStream(f);
        this.interpreter.setOut(p); 
        print(sampleResult.getSampleLabel() + "," + responseTime);
        f.close(); 
    }
    
    long responseTime=sampleResult.getEndTime()-sampleResult.getStartTime();
    如果(响应时间<400){
    FileOutputStream f=新的FileOutputStream(“myreport.csv”,true);
    打印流p=新打印流(f);
    本.解释.出发(p);
    打印(sampleResult.getSampleLabel()+“,”+响应时间);
    f、 close();
    }
    
    但是,如果您计划对多个(超过200-300个)用户和多个“适合”过滤器的操作运行压力测试,那么这种方法的性能可能不够

  • 最简单的解决方案是将标签、运行时间和/或延迟保存到CSV文件,该文件将生成如下原始输出:

    elapsed,label
    423,sampler1
    452,sampler2
    958,sampler1
    152,sampler1
    
    long responseTime = sampleResult.getEndTime() - sampleResult.getStartTime();
    if(responseTime < 400) {
        FileOutputStream f = new FileOutputStream("myreport.csv", true);
        PrintStream p = new PrintStream(f);
        this.interpreter.setOut(p); 
        print(sampleResult.getSampleLabel() + "," + responseTime);
        f.close(); 
    }
    
    从这里,您可以将其带到任何其他工具(awk、Excel等)以筛选所需的结果

  • 另一种选择是使用动态生成此类报告。大概是这样的:

    elapsed,label
    423,sampler1
    452,sampler2
    958,sampler1
    152,sampler1
    
    long responseTime = sampleResult.getEndTime() - sampleResult.getStartTime();
    if(responseTime < 400) {
        FileOutputStream f = new FileOutputStream("myreport.csv", true);
        PrintStream p = new PrintStream(f);
        this.interpreter.setOut(p); 
        print(sampleResult.getSampleLabel() + "," + responseTime);
        f.close(); 
    }
    
    long responseTime=sampleResult.getEndTime()-sampleResult.getStartTime();
    如果(响应时间<400){
    FileOutputStream f=新的FileOutputStream(“myreport.csv”,true);
    打印流p=新打印流(f);
    本.解释.出发(p);
    打印(sampleResult.getSampleLabel()+“,”+响应时间);
    f、 close();
    }
    
    但是,如果您计划对多个(超过200-300个)用户和多个“适合”过滤器的操作运行压力测试,那么这种方法的性能可能不够


  • 不久前我遇到了一个类似的问题,并编写了一个小工具-请参见

    我不久前遇到了一个类似的问题,并编写了一个小工具-请参见

    JMeter为OOTB提供了一个Web报告,该报告提供了大量有关负载测试的信息,这些信息使用了标准度量,如APDEX、百分位数

    见此:

    如果仍然需要此选项,请执行以下操作:

    添加为您请求的子项添加:

    下面的所有响应都将被标记为失败。
    在报告中,您将获得满足此SLA标准的成功请求数。

    JMeter提供OOTB一个Web报告,该报告使用APDEX、Percentiles

    见此:

    如果仍然需要此选项,请执行以下操作:

    添加为您请求的子项添加:

    下面的所有响应都将被标记为失败。 在报告中,您将获得满足此SLA标准的成功请求数