Thursday, November 26, 2009

Performance env health check file

Previously, before i start perf testing, i usually went through the application to see if application works well. Checking if each server's java process running successfully or not at first will save us time(based on my working experience)

By just one click, I can tell the specific server contains Java process or not.

here is source file(BTW, you should input Gawk into the PsTools as well):

set PS_TOOLS_HOME=D:\\PsTools
set JVM_IP1=192.168.1.1

%PS_TOOLS_HOME%\pslist \\%JVM_IP1% -u "domain\username" -p "pwd" -e java | %PS_TOOLS_HOME%\gawk "{if($1 !~ /java/) {} else {print $0, \"\nGot you Java! :-)\"}}"
echo %JVM_IP1% Health check finished

Sunday, November 22, 2009

Web access log analysis with Awk for Performance test modeling

I try to extract some end users' actions from Web access log, so that i can design my performance testing scenarios more accurately, not by assumption.

The scripts' purpose is to filter all the .do actions from access.log and i can use the output file to do more complexed analysis.

I named my script as "W3A.txt", here is the source:

 Begin {i=1}  
 $7~/\.do/ {  
 {if (i==ARGIND) {  
 sub(/;jsessionid=[0-9a-zA-Z]+.worker[0-9]/,"",$7 );  
 sub(/\?[a-zA-Z0-9_=&-\/:\?%]+/,"?",$7);  
 print $4,$7,$11 > i  
 }  
 else i++  
 }  
 { if (i> ARGIND)  
 exit 1  
 }  
 }  
 END{}  

(P.S. This log will give me each action's date/time, URL, response time)

how to use it?
$ awk -f W3A.txt access.2009-11-*_perf.log


Generated result files:
1.log
2.log
...


P.S.it can process multiple log files, and also generating result logs based on each log you put into the augments separately. if you just want to generate single result file, i think it is much easier than i did here :)
Hope helps!

Thursday, November 19, 2009

JMeter "leaks" by storing the raw data into the heap

almost 1 year ago i wrote about load generated by JMeter decreasing after long time running, looking at this :http://joychester.blogspot.com/2009/01/jmeter-load-get-decreasing-after-long.html

After looking at the Heapdump of JMeter after on day running, we got the suspect:



I prefered to using the Aggregate listener as always, so it indeed to store every single response data into Heap, it may be one of the reason cause Jmeter slower and slower to generate the load itself.

Wednesday, November 18, 2009

Jmeter __javascript() got blocked

One of my Friends are using JMeter 2.3.2 __javascript() func to generate Random number, but after using VisualVM to monitoring Jmeter, we found such a threaddump:
"Thread Group 1-18" prio=6 tid=0x379c3800 nid=0xf3c runnable [0x39f2f000..0x39f2fd18]
java.lang.Thread.State: RUNNABLE
at org.mozilla.javascript.gen.c123605._c0()
at org.mozilla.javascript.gen.c123605.call()
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:340)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2758)
at org.mozilla.javascript.gen.c123605.call()
at org.mozilla.javascript.gen.c123605.exec()
at org.mozilla.javascript.Context.evaluateString(Context.java:1132)
at org.apache.jmeter.functions.JavaScript.execute(JavaScript.java:94)
- locked <0x0b9991e0> (a org.apache.jmeter.functions.JavaScript)
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:138)
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:107)
....

"Thread Group 1-17" prio=6 tid=0x390f4c00 nid=0x288 waiting for monitor entry [0x39edf000..0x39edfd98]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.jmeter.functions.JavaScript.execute(JavaScript.java:73)
- waiting to lock <0x0b9994a8> (a org.apache.jmeter.functions.JavaScript)
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:138)
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:107)
at org.apache.jmeter.testelement.property.FunctionProperty.getStringValue(FunctionProperty.java:87)
at org.apache.jmeter.testelement.property.AbstractProperty.hashCode(AbstractProperty.java:221)
at java.util.HashMap.getEntry(Unknown Source)
at java.util.HashMap.containsKey(Unknown Source)
at java.util.HashSet.contains(Unknown Source)
at org.apache.jmeter.testelement.AbstractTestElement.isTemporary(AbstractTestElement.java:376)
at org.apache.jmeter.testelement.AbstractTestElement.recoverRunningVersion(AbstractTestElement.java:351)
at org.apache.jmeter.threads.JMeterThread.notifyTestListeners(JMeterThread.java:561)
at org.apache.jmeter.threads.JMeterThread.access$200(JMeterThread.java:60)
....

"Thread Group 1-15" prio=6 tid=0x37149000 nid=0x878 waiting for monitor entry [0x39e3f000..0x39e3fa98]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.jmeter.functions.JavaScript.execute(JavaScript.java:73)
- waiting to lock <0x0b998000> (a org.apache.jmeter.functions.JavaScript)
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:138)
at org.apache.jmeter.engine.util.CompoundVariable.execute(CompoundVariable.java:107)
....


Here is the source code for your reference :)


public synchronized String execute(SampleResult previousResult, Sampler currentSampler)
throws InvalidVariableException {

JMeterContext jmctx = JMeterContextService.getContext();
JMeterVariables vars = jmctx.getVariables();

String script = ((CompoundVariable) values[0]).execute();
// Allow variable to be omitted
String varName = values.length < 2 ? null : ((CompoundVariable) values[1]).execute().trim();
String resultStr = "";


then you know why...
__javascript() itself got Performance problem, So be Careful to use __javascript when you perform load testing

Tuesday, November 17, 2009

Generating Heapdump On JDK5(v16+)

Teammates and I are doing one thing to get our life a little bit easier--Generating Heapdump On JDK5(V16+); P.S. unfortunately you could not using this way if you are using lower version of JDK5, like JDK1.5.0_11... A bug reported here for your information, you have to use JDK5(V16+): http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6454676

Thanks Andy and Adams' great idea and Support!!
0. download PsTools and SendSignal and gawk into your target machine as PS_TOOLS_HOME
1. Add -XX:+HeapDumpOnCtrlBreak in your JVM arguments
2. Using SendSignal to simulate the Ctl+Break signal to the service

here is the HeapGen.bat file, hope this helps you too:

 @echo off  
 rem -------------------------------------------------------------------------  
 rem Invoking Remote JVM to do Heap Dump Script for Win32  
 rem 1. Please replace your directory of PsTools  
 rem 2. Please set IP before execute it  
 rem -------------------------------------------------------------------------  
 set PS_TOOLS_HOME=D:\\PsTools  
 set JVM_IP=10.279.33.33  
 set HPROF_HOME=D:\abc\efg\bin  
 echo ===================================================================================  
 echo .  
 echo Your Directory of PsTools is %PS_TOOLS_HOME%  
 echo .  
 echo The Remotely Controlled Machine is %JVM_IP%  
 echo .  
 echo Heap dump is created in a file in the working  
 echo directory of the VM namely %HPROF_HOME%  
 echo .  
 echo =================================================================================== 
 echo .  
 %PS_TOOLS_HOME%\pslist \\%JVM_IP% -u "${Domainname}\${yourusername}" -p "${yourpassword}" -e java | %PS_TOOLS_HOME%\gawk "{if($1 ~ /java/) system(\" %PS_TOOLS_HOME%\\psexec \\\\%JVM_IP% -d -c %PS_TOOLS_HOME%\\SendSignal \" $2)}"  
 echo .  
 echo ===================================================  
 echo .  
 echo Heap Dump file has been created  
 echo .  
 echo ===================================================  
 echo .