net
net

Reputation: 1

I am getting JMeter Out of Memory error even after I already upgraded my RAM from 8G to 16G

Can someone please help me with the Out of Memory (OOM) error that I encountered while running JMeter

I am a newbie in Java and in JMeter, and also in performance testing. I used the command prompt but I am still encountering Out of Memory issue. I tried to adjust the heap size but running did not continue every time I change it.

My current heap size is below

    set HEAP=-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m

I added another memory: from 8GB, my memory is now 16GB.
But when I run it again with 1000 threads, the error below is shown:

Uncaught Exception java.lang.OutOfMemoryError: unable to create new native thread in thread Thread[Thread Group 1-130,5,main]. See the log file for details.
Uncaught Exception java.lang.OutOfMemoryError: unable to create new native thread in thread Thread[Thread Group 1-63,5,main]. See log file for details.
Uncaught Exception java.lang.OutOfMemoryError: unable to create new native thread in thread Thread[Thread Group 1-135,5,main]. See log file for details.
Uncaught Exception java.lang.OutOfMemoryError: unable to create new native thread in thread Thread[Thread Group 1-19,5,main]. See log file for details.
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 32756 bytes for ChunkPool::allocate

Sometimes I am also encountering just this error:

# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 32756 bytes for ChunkPool::allocate

Can someone please help me. I am just a beginner so I would appreciate if you will reply with terms that are not too technical.

Thank you in advance.

Upvotes: 0

Views: 2086

Answers (4)

Moorthi Raj
Moorthi Raj

Reputation: 21

I have faced the out of memory issue on trying to run 10k vusers in 8GB RAM. Later on increased the instance memory as 16GB and 10k vusers load ran successfully.

  1. Increase JVM memory as 12 GB in /etc/profile/

  2. Increase JMeter Heap as 10GB in "jmeter" file(Linux OS). ('set HEAP' option is available in "jmeter.bat" file for Windows server)

3.Open files limit - 65535

  1. maximum user process limit - 65535

Open the command window as root user Execute following commands and update values to change the default limit

  1. vim /etc/security/limits.conf

root soft nproc 65535 root hard nproc 65535 root soft nofile 65535 root hard nofile 65535

  1. vim /etc/sysctl.conf

fs.file-max = 65535

sysctl -p

  1. reboot

After rebooting, the changes will be affected in the machine and kindly cross verify that.

Should run the JMeter script in Non-GUI as a root user only.

Note: Delete dump heap file in "bin" if any.

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168002

The error you're getting indicates that underlying operating system is not able to create a new native thread / process.

  1. Try increasing limits for the operating system, i.e. if you're on Linux you can check the maximum number of threads using ulimit -n command
  2. In any case you can decrease the stack size via -Xss JVM argument

Unfortunately in its current shape your question doesn't provide enough information in order to come up with a comprehensive answer, if above hints don't help consider adding more details like:

  • Operating system version and architecture
  • JMeter version
  • Java version and archivecture
  • At least first 20 lines of the .HPROF file

Also make sure to follow recommendations from the 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure article

Upvotes: 1

Chandra Sekhar Y
Chandra Sekhar Y

Reputation: 550

change Heap size in jmeter.sh file if you are using Linux/ubuntu, Jmeter.bat in windows. Increase the -Xmx1g =to half of the memory of the system i.e., 4gb(-Xmx4g). also try to increase the user load from 500 and check the CPU and RAM utilization in Task Manager of Windows.

Upvotes: 0

Bilal Shehata
Bilal Shehata

Reputation: 61

the flag Xmx indicates the maximum memory for the JVM. You should increase your xmx value to something more appropriate for your usage.

try:

set HEAP=-Xms1g -Xmx4g -XX:MaxMetaspaceSize=256m

Upvotes: 0

Related Questions