1

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

msrd0
  • 7,816
  • 9
  • 47
  • 82
DevD
  • 1,201
  • 2
  • 12
  • 20

2 Answers2

7

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.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Thanks it did increase the performance of Jmeter but the memory utilized still seems go max upto 800MBs on the activity monitor. Still throws out of memory error. I am novice with Jmeter so please advice - Is 5 requests per second for overall 10,000 requests too much if i am allocating `java -Xms2G -Xmx4G -jar ApacheJMeter.jar` i.e. max 4G memory for a system with 16G memory/Quad core proc. Thanks! – DevD Sep 22 '14 at 16:35
  • 1
    update your JRE to 1.7., this should solve the problem. – Zubair M Hamdani Sep 23 '14 at 06:58
  • @JmeterPerfTest Thanks i upgraded java to 1.8 and the memory being utilized or seems to be is now upto 1.5 GB on activity monitor even though i have setup the min as 2GB and max as 4GB. Still max tests i can run it seems is for 2000 requests at one go @ 5 requests per second to avoid the out of memory error. – DevD Sep 24 '14 at 06:26
  • Can you provide some details about the scenario you are testing. – Zubair M Hamdani Sep 24 '14 at 06:51
  • @JmeterPerfTest hey i missed your comment i think. Let me know what details you need. I am testing my web services that perform db transactions. I observed i can only run max 2000 users with single jmeter installation to avoid out of memory error. otherwise based on the requirement the jmeter service utilizes memory as required ~ upto 1.5G to 3G as i was able to see. and number of requests per second depend on how much load my web service can take before it starts rejecting connections. – DevD Sep 28 '14 at 04:50
1

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
Joseph Cass
  • 119
  • 1
  • 3