You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by "He Yin (测试部_贺寅)" <he...@yihaodian.com> on 2013/01/14 11:09:15 UTC
Scripting language performance
Hello,
In another thread, I noticed Philippe mentioned that " JSR223 Samplers + Groovy + Caching" is a better choice then Beanshell. Since I used a lot of Beanshell in my scripts and never pay attention to it, I decided to make an investigation of this issue.
I simplified one of my beanshell script, rewrited it into groovy and rhino and put them into script-samplers instead of pre-processors.
The result turned out that
1) Beanshell is better than other solutions
2) Groovy and javascript will cause some gc problems.
3) Groovy
3) BSF and JSR223 seems that waste some cpu time on their framework.
Am I doing something wrong?
(Thread:10, Loop 500)
Label Samples Average Median 90% Min Max Error% Throughput KB/sec GC occurs
JSR223-groovy 5000 59 39 119 6 3077 0 145.2137546 0 1~2
JSR223-rhino 5000 2 1 2 0 314 0 851.9338899 0 frequently
BeanShell Sampler 5000 1 1 2 0 402 0 1068.832835 0 0
BSF-beanshell 5000 33 27 63 3 328 0 270.6506441 0 0
BSF-javascript 5000 20 6 44 1 640 0 324.7174958 12.68427718 frequently
Environments: JMeter 2.8,
Uncomment " jsr223.compiled_scripts_cache_size" in jmeter.properties
Groovy version: groovy-all-2.0.6
JVM_OPTS:
set HEAP=-Xms512m -Xmx512m
set NEW=-XX:NewSize=128m -XX:MaxNewSize=128m
set SURVIVOR=-XX:SurvivorRatio=8 -XX:TargetSurvivorRatio=50%
set TENURING=-XX:MaxTenuringThreshold=2
set RMIGC=-Dsun.rmi.dgc.client.gcInterval=600000 -Dsun.rmi.dgc.server.gcInterval=600000
set PERM=-XX:PermSize=64m -XX:MaxPermSize=64m
Script for Beanshell and groovy:
for (int i=0;i<10;i++){
line="1027448,1".split(",");
pid=line[0];
mid=line[1];
vars.put("pid"+i,pid);
vars.put("mid"+i,mid);
}
cartParam="";
for (int i=0;i<10;i++){
pid=vars.get("pid"+i);
mid=vars.get("mid"+i);
param=mid+"_"+pid+"_"+"0_0_1=1";
if (cartParam=="")
cartParam=param;
else
cartParam+=","+param;
}
vars.put("cartParam",cartParam);
Script for rhino and javascript:
for (var i=0;i<10;i++){
line="1027448,1".split(",");
pid=line[0];
mid=line[1];
vars.put("pid"+i,pid);
vars.put("mid"+i,mid);
}
var cartParam="";
for (var i=0;i<10;i++){
pid=vars.get("pid"+i);
mid=vars.get("mid"+i);
param=mid+"_"+pid+"_"+"0_0_1=1";
if (cartParam=="")
cartParam=param;
else
cartParam+=","+param;
}
vars.put("cartParam",cartParam);