【问题标题】:Jmeter. JSR223+Grovy 2.4.5 sampler response times degradation万用表。 JSR223+Grovy 2.4.5 采样器响应时间退化
【发布时间】:2015-12-02 09:58:07
【问题描述】:

(问题从Jmeter protobuf testing. Could not read Protobuf message继续) 我正在通过 Protobuf 协议测试应用程序。最初我使用 HTTP 采样器,但将二进制数据保存到字符串时出现问题。 解决方案是使用带有 HTTPClient 和 POST 请求的 Beanshell 采样器以及正文中的二进制数据:

byte[] data = null;
//...assign protobuf binary buffer to data...

HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("http://127.0.0.1");
HttpEntity entity = new ByteArrayEntity(data);
post.setEntity(entity);
post.setHeader(HttpHeaders.CONTENT_TYPE, "application/octet-stream");
HttpResponse response=null;
try {
    response = client.execute(post);
} catch (ClientProtocolException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
}

ResponseCode = response.getStatusLine().getStatusCode().toString();
//if some assert is true then
Issuccess = true;
ResponseMessage="Some Response Message";

因为我尝试为成千上万的并发用户提供高负载,所以我开始使用 JSR223+Grovy 采样器而不是 Beanshell 采样器(受这篇文章 https://blazemeter.com/blog/beanshell-vs-jsr223-vs-java-jmeter-scripting-its-performance 影响)

在测试期间,所有 JSR223 采样器的响应时间都有一个强劲的增长:

然后创建了一个新的测试计划并将所有 JSR223 替换为 Beanshell 采样器(没有重置选项)。图片没问题(同比例图):

那么如何识别 JSR223 的问题或修复它。另一个问题是,当 JST223+Grovy 提供这些问题时,为什么每个人都推荐使用它?

【问题讨论】:

    标签: jmeter beanshell jsr223


    【解决方案1】:

    嗯,好的,在这篇文章中推荐使用编译缓存键。我没看见过它。现在一切正常。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-05
      • 1970-01-01
      相关资源
      最近更新 更多