Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JMeter issues when running large number of threads

Tags:

jmeter

I'm testing using Apache's Jmeter, I'm simply accessing one page of my companies website and turning up the number of users until it reaches a threshold, the problem is that when I get to around 3000 threads JMeter doesn't run all of them. Looking at the Aggregate Graph it only runs about 2,536 (this number varies but is always around here) of them.

The partial run comes with the following exception in the logs:

01:16 ERROR - jmeter.JMeter: Uncaught exception: 
java.lang.OutOfMemoryError: unable to create new native thread
    at java.lang.Thread.start0(Native Method)
    at java.lang.Thread.start(Unknown Source)
    at org.apache.jmeter.threads.ThreadGroup.start(ThreadGroup.java:293)
    at org.apache.jmeter.engine.StandardJMeterEngine.startThreadGroup(StandardJMeterEngine.java:476)
    at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:395)
    at java.lang.Thread.run(Unknown Source)

This behavior is consistent. In addition one of the times JMeter crashed in the middle outputting a file that said:

# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 32756 bytes for ChunkPool::allocate
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (allocation.cpp:211), pid=10748, tid=11652
#
# JRE version: 6.0_31-b05
# Java VM: Java HotSpot(TM) Client VM (20.6-b01 mixed mode, sharing windows-x86 )

Any ideas?
I tried changing the heap size in jmeter.bat, but that didn't seem to help at all.

like image 381
Irony Avatar asked Jan 30 '13 18:01

Irony


People also ask

Can JMeter handle more than one thread per test?

Considering only the JMeter resource consumption, if you find that the JMeter host can't handle the number of threads you want the resolution is the same as for running out of memory: more of the resource, simpler test plan, less threads, or JMeter server.

What is the maximum number of users JMeter can handle?

up vote 4 down vote. '10000 users' using jmeter is pretty tough on single machine considering given configuration, the maximum number of threads supported by jmeter will be 300 to 400 depending on your script, eventually jmeter will get stuck with 'OutOfMemoryError' and it will create a very large dump file.

What are the common issues while using JMeter?

While running the JMeter scripts, you might come across few common issues. Some of the commonly faced issues while using JMeter are discussed below Error: jmeter.threads.JMeterThread: Test failed! java.lang.OutOfMemoryError: Java heap space

What is Thread Group in JMeter Test Plan?

As we know JMeter is a pure Java-based desktop tool to conduct load and performance testing. There are various test plan elements in JMeter like Thread group, controllers, listeners, timers, etc. In this article, we are going to learn about the Thread group element of JMeter. Thread group is the basic element of the Jmeter Test plan.


2 Answers

I had a similar issue and increased the heap size in jmeter.bat to 1024M and that fixed the issue.

set HEAP=-Xms1024m -Xmx1024m
like image 147
Siva Avatar answered Sep 18 '22 09:09

Siva


I ran into this same problem and the only solution that helped me is: https://stackoverflow.com/a/26190804/5796780

proper 100k threads on linux:

ulimit -s  256
ulimit -i  120000
echo 120000 > /proc/sys/kernel/threads-max
echo 600000 > /proc/sys/vm/max_map_count
echo 200000 > /proc/sys/kernel/pid_max 

If you don't have root access:

echo 200000 | sudo dd of=/proc/sys/kernel/pid_max
like image 43
Vijay Avatar answered Sep 17 '22 09:09

Vijay