Sanjay Bhatia
Sanjay Bhatia

Reputation: 97

Jmeter gives java.lang.OutOfMemoryError beyond 2000 threads, even after increasing the heap size to maximum

I am running load test on my target using concurrency thread group. I have also increased the heap size to 6GB. Now when I run the script, beyond 2000 threads it gives

Failed to start thread - pthread_create failed (EAGAIN) for attributes: stacksize: 1024k, guardsize: 4k, detached.
Uncaught Exception java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached. See log file for details.

I tried varying the heap size from 512MB to 8GB but every time it cannot go beyond 2000 threads

Upvotes: 0

Views: 4150

Answers (2)

Zohair
Zohair

Reputation: 268

There are 2 solutions to overcome this problem.

1- You should use distributed testing for larger threads, the recommended solution.

2- You need to adjust the ramp up period accordingly to accommodate larger thread numbers.

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168002

The error means that the underlying operating system has failed to create a new thread so you need to tweak the operating system in order to allow creating more threads for the process/current user.

If you don't have administrator/root access to the machine where JMeter is running you will have to go for distributed testing as you will not be able to overcome the OS limit on the number of processes. Amending JMeter's HEAP will not help.

Upvotes: 4

Related Questions