(问题从Jmeter protobuf testing. Could not read Protobuf message继续) 我正在通过Protobuf协议测试应用程序。最初我使用HTTP采样器,但将二进制数据保存到字符串时出现问题。 解决方案是使用BeanShell的取样与身体的二进制数据了HTTPClient和POST请求:Jmeter。 JSR223 + Grovy 2.4.5采样器响应时间降级
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";
因为我尝试提供高负载数千concurent用户的我开始使用JSR223 + Grovy取样,而不是BeanShell的samler
(在本文https://blazemeter.com/blog/beanshell-vs-jsr223-vs-java-jmeter-scripting-its-performance受以下因素影响),在试验过程中所有JSR223采样具有响应时间的强劲增长:
然后,创建一个新的测试计划和刚刚更换所有JSR223与Beanshell采样器(无需重置选项)。图片是确定(在同一尺度图):
因此,如何认识到什么是错JSR223或可能解决它。另一个问题是为什么每个人都会建议在使用JST223 + Grovy时提供这些问题?