Saturday, April 30, 2011

JMeter and OutOfMemory

I have been working on Jmeter for a week now. The tool is tough and good . There is lot to learn in this tool . Although i have faced quite a few problems to keep this running , the main one that troubled me was the OUTOFMEMORY error which really frustrated me well.

My requirement was to regenerate an out of memory error which a customer of our product was getting .That was a tricky one as we were not getting it here . So started my load test on my application . My intial requirement was to run 25 threads and see whether i can get outofmemory in my application. I recorded my application, got the setups ready and started the JMeter run .

I got an Out of Memory 1o minutes after the Jmeter got started.

Things i did starts from here

1. Increased the JVM head size settings in jmeter.bat file present under jmeter\bin location. First time i increased the settings from 512m to 1024m . Saved and stated running the Jmeter .Same OutofMemory again after 1 hour of running

Line to change in the bat file "set HEAP=-Xms512m -Xmx512m " .
Xms - starting RAM the jvm will take
Xmx - maximum RAM that is allowed for the HEAP.

2. Now i changed my test machine from 2GB Ram to 4 GB Ram and tried to allocate 2048m to it .But could not succeed as i was not able to start the Jmeter with the following error.
" JVM could not be initialized."

Now so had to reduce the Heap allocation size . Had it set to 1536m and ran it .It ran successfully for 1 hr and again the same problem .

3. Now the final thing i did was changing the 32 bit machine to 64-bit machine . This seems to be running well .

Will update the post if i run into some problem again

Also few more points

Listeners used in Jmeter while load testing can take lot of memory which can lead to a OutOfMemory . View Tree Results which is useful for debugging indeed takes more memory .Aggregate Listener and Spline Listener would be better to use .Graph Listener is also better , but this also consumes more memory.

No comments:

Post a Comment