1

When running JMeter, java server has the -Xmx value of only 512 MB. I tried to change it via following code in the jmeter.bat.sh file.

set HEAP=-server -Xms512m -Xmx6144m

set NEW=-XX:NewSize=512m -XX:MaxNewSize=6144m

also tried this:

set HEAP= -Xms512m -Xmx6144m

set NEW=-XX:NewSize=512m -XX:MaxNewSize=6144m

By checking the process after while JMeter is running I can see that java -sever doesn't recognize this setting.

Puce
  • 37,247
  • 13
  • 80
  • 152
JohnSmith
  • 1,078
  • 1
  • 10
  • 21
  • Are you using jmeter 3.2? – Ori Marko Sep 14 '17 at 10:32
  • I'm using Jmeter 3.1 – JohnSmith Sep 14 '17 at 10:35
  • Have you read https://stackoverflow.com/questions/6450132/java-seems-to-ignore-xms-and-xmx-options? – Ori Marko Sep 14 '17 at 10:36
  • yep, but when I run my jmeter command, the java sever get's started by jmeter I guess. So I can't actually pass another parameter to it, or is there a way? – JohnSmith Sep 14 '17 at 10:38
  • check below links for detailed info; https://stackoverflow.com/questions/34160452/increase-memory-for-jmeter-on-command-line https://www.blazemeter.com/blog/9-easy-solutions-jmeter-load-test-%E2%80%9Cout-memory%E2%80%9D-failure https://stackoverflow.com/questions/34160452/increase-memory-for-jmeter-on-command-line – Akhil S Kamath Sep 14 '17 at 10:41
  • that was really helpful, thank you. but know the virtual memory gets blown up to 10GB, and even if I kill the PID it still starts from the same level the last JMeter test finished. – JohnSmith Sep 14 '17 at 11:28
  • there's `jmeter`, `jmeter.bat`, `jmeter.sh` and a few more, but no `jmeter.bat.sh`. So which did you try to change and how do you invoke jmeter? also setting `MaxNewSize` and `Xmx` to the same value doesn't make much sense (it's like not setting it at all) – timbre timbre Sep 14 '17 at 16:30
  • thx @KirilS., how should the relation between `MaxNewSize` and `Xmx` be? – JohnSmith Sep 14 '17 at 17:02
  • In most cases you don't need to specify MaxNewSize. You only need to worry about it if you found out (through testing) that allocated new size is sometimes too big. But in your case, seems you don't have such information, so just leave it alone – timbre timbre Sep 14 '17 at 18:39
  • I'm running the app and also JMeter from two c4x.large boxes. Using the CMS garbage collector via `-XX:+UseConcMarkSweepGC` seems to help not to run into a Java memory overflow. But Java still seem to have around 9GB in usage when starting JMeter `jmetert+ 8616 0.0 0.0 4508 1764 pts/1 S+ 11:05 0:00 /bin/sh ./jmeter.sh -n -t /home/jmetertestuser/TP_Login_Account_Project_Runbook.jmx ... jmetert+ 8642 214 8.3 9097220 684892 pts/1 Sl+ 11:05 0:06 java -Xms512m -Xmx6144m -XX:NewSize=512m -XX:MaxNewSize=1024m -XX:+UseConcMarkSweepGC -jar ./ApacheJMeter.jar -n -t ...` – JohnSmith Sep 15 '17 at 10:07

1 Answers1

1

If you are running jmeter startup script on Linux the syntax will be different, i.e:

HEAP="-Xms512m -Xmx6G"

as SET command is something Windows-specific

Alternatively you can define JVM_ARGS environment variable value like:

JVM_ARGS="-server -Xms512m -Xmx6G" && export JVM_ARGS

this way you won't need to edit files and/or restart JMeter.

Finally, you can launch JMeter jar directly like:

java -server -Xms512m -Xmx6G -jar ApacheJMeter.jar

See the following reference material:

Dmitri T
  • 159,985
  • 5
  • 83
  • 133