哪一个有效:我的脚本是Java Request,JSR223或BeanShell Sampler [英] Which one is efficient : Java Request, JSR223 or BeanShell Sampler for my script

查看:99
本文介绍了哪一个有效:我的脚本是Java Request,JSR223或BeanShell Sampler的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想发送一个字节数组,这是内置的HTTP Sampler无法实现的.

I want to send a a byte array which is not possible with the inbuilt HTTP Sampler.

所以继续使用BeanShell采样器.

So went ahead with BeanShell sampler.

但是我发现BeanShell Sampler的响应有些滞后

But i found some time lagging in response of BeanShell Sampler

在我的代码中,我正在向Web服务端点发送一个硬编码的字节数组.

In my code I am sending a hard-coded byte array to the web service endpoint.

是否有比Java Request或JSR223更好的方法,它们的执行时间比beanshell采样器的执行时间短?

Is there a better approach like Java Request or JSR223 whose execution time is lesser than that of beanshell sampler

推荐答案

行为规范具有 Groovy 语言和.与Beanshell相比,启用apache.org/usermanual/best-practices.html#jsr223"rel =" nofollow noreferrer>编译缓存功能的速度更快,并且占用的内存更少.切记不要直接在Groovy脚本主体中以${var}的形式引用JMeter函数或变量.

Well-behaved JSR223 Sampler with Groovy language and Compilation Cache feature enabled will work faster and have lesser memory footprint than Beanshell. Remember not to reference JMeter Functions or Variables in form of ${var} directly in Groovy script body.

Java Request 采样器将是最快的,但是会更难进行更改,因为您将不得不重新编译代码,请将其放在 JMeter Classpath 并重新启动JMeter,甚至进行微不足道的更改.

Java Request sampler will the fastest one, however it will be harder to make changes as you will have to recompile your code, put it to JMeter Classpath and restart JMeter even for trivial change.

更多信息: Beanshell vs JSR223与Java JMeter脚本:性能一直在等待中!

尤其是在您的情况下,您可以使用 HTTP原始请求代替脚本.

Particularly in your case you can use HTTP Raw Request instead of scripting.

这篇关于哪一个有效:我的脚本是Java Request,JSR223或BeanShell Sampler的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆