Unable to increase heap size for JMeter on Mac OSX

2019-06-02 02:16发布

问题:

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

回答1:

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.