DevD
DevD

Reputation: 1231

Unable to increase heap size for JMeter on Mac OSX

Is there a way to increase heap size of JMeter in Mac OSX? I have tried editing the jmeter.bat file, but it didn't help.

I edited the jmeter.sh file to add JVM_ARGS="-Xms3072m -Xmx3072m" jmeter.sh

I tried the following also

#!/bin/bash

heap_size='3072m'
JAVA_CMD="java -Xms$heap_size -Xmx$heap_size" meter`

as suggested in this link increase the memory allocated to jmeter in ubuntu linux

Does any one know how to do it in Mac OSX. I have java version as follows:

java version 1.6.0_65
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)`

on OSX 10.9.4

Upvotes: 1

Views: 18257

Answers (2)

Joseph Cass
Joseph Cass

Reputation: 149

I installed JMeter on my Mac via Homebrew and found that I needed to create a new setenv.sh file containing the configurations, as specified in the jmeter file instructions:

Do not set the variables in this script. Instead put them into a script

setenv.sh in JMETER_HOME/bin to keep your customisations separate.

I found that the JMETER_HOME path was /usr/local/Cellar/jmeter/5.4.3/libexec/ as opposed to /usr/local/Cellar/jmeter/5.4.3/ which I initially tried unsuccessfully.

So, in the end, I had /usr/local/Cellar/jmeter/5.4.3/libexec/bin/setenv.sh conatining:

HEAP="-Xms2g -Xmx4g -XX:MaxMetaspaceSize=512m"
NEW="-XX:NewSize=512m -XX:MaxNewSize=1024m"

Which I verified was working from the following in the jmeter.log file:

INFO o.a.j.JMeter: Max memory     =4294967296

Upvotes: 1

Dmitri T
Dmitri T

Reputation: 168092

As per JMeter Performance and Tuning Tips

Default JMeter java configuration comes with 512 Mo and very little GC tuning. First ensure you set -Xmx option value to a reasonable value regarding your test requirements. Then change MaxNewSize option in jmeter file to respect the original ratio between MaxNewSize and -Xmx.

Java Virtual Machine parameters can be tuned in jmeter script file which lives under /bin folder of JMeter installation. So

  1. Open jmeter script with text editor of your choice
  2. Look for the line HEAP="-Xms512m -Xmx512m"
  3. Change minimum and maximum values according to your desires
  4. Save the file and make sure that you're executing jmeter, not jmeter.sh

If you're looking for once-only command-line JVM args overriding you can call JMeter main jar directly without any shell script wrappers as

java -Xms1G -Xmx3G -jar ApacheJMeter.jar

The command above assumes that you're invoking it from /bin folder of your JMeter installation.

Upvotes: 8

Related Questions