You are here

increase the memory allocated to jmeter in ubuntu linux

I was struggling with jmeter running out of memory when doing some load testing, and almost all of the instructions I found about how to increase the java heap size and give jmeter more memory were for windows, and talked about editing a jmeter.bat file which I do not have on my ubuntu (10.04 LTS) machine.

Other posts suggested setting various environment variables (e.g. HEAP or JVM_ARGS), but these didn't seem to work for me.

I finally found the correct incantation - or at least one that works. You could edit the jmeter script at /usr/bin/jmeter (or wherever yours lives), but I prefer to create a little launcher script so that I don't lose my changes with a package update.

So here's the launcher script I'm using:

#!/bin/bash
 
heap_size='1536m'
JAVA_CMD="java -Xms$heap_size -Xmx$heap_size" jmeter

I suppose you could set JAVA_CMD elsewhere, but you may not want it to get picked up by whatever other java apps you use.

I would imagine the same approach would be valid in other flavours of linux too.

Share and enjoy.

Comments

It also worth checking out JMeter Performance and Tuning Tips guide for JMeter performance tuning best practices. It helped me a lot and allowed to greatly reduce number of hosts which I used for remote testing

Where would you place the above script and how would you finally execute the .jmx file on ubuntu ec2 instance, can you please describe a bit more?