Unable to solve “Uncaught Exception java.lang.OutOfMemoryError: unable to create new native thread” when testing with multiple threads in JMeter
I am load testing MQTT connection with JMeter. The test runs in NON-GUI mode. All listeners were disabled during the test. Everything was fine until I increased thread number from 2k to 3k. Now, this error occurs when I am running the test: Uncaught Exception java.lang.OutOfMemoryError: unable to create new native thread. See log file for details. I tried increasing the HEAP size by editing the executable file "jmeter" Here is how I edited it. I changed it from 512m to 1024m: But it doesn't work. Then I changed to a larger value 2048m, still doesn't work. I searched for this problem and found out that it might have something to do with the thread stack size. Some pointed out that I may set the thread stack size in the script too. So I tried adding the thread stack size in the executable file. This is how I did it: I am not sure if it is the correct way. It didn't work too. Some also says that maybe the HEAP size or the Thread stack size of the JVM should be increased. Then I came across this tutorial by MKYoung:https://www.mkyong.com/java/how-to-set-java_home-environment-variable-on-mac-os-x/ stating the ways to change the HEAP size and the thread stack size of java. But for setting to work I have to state a java class file at the end of the command. java -Xss256k <class name here> But the Jmeter is unix executable and there doesn't seem to be any java class files there. I am really running out of ways. Please help.
Execute ulimit -u command (shows max user processes) and amend it according to number of threads you are trying to use (and a little bit more so other processes could operate), check out How to change default number of max process per user in linux thread for details. Apart from this make sure you are following recommendations from 9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure guide.
Should you save an argument to an instance variable when it's going to be passed through multiple methods?
run a jarfile in a different machine from an sqlserver/issue a terminal command from an sqlserver to another windows machine
How to ensure that `methodB` is “blocked” if some threads are in `methodA` in Java?
JUnit :java.lang.IllegalStateException while executin event.queue() where event is ValueChangeEvent instance
java restful api call sql server stored procedure and get back json object
JAVA - Storing data from result set to hashmap and aggregating them
Why does the Injection of autowired dependencies failed in Spring web-service?
Is it possible to use an extended formal type parameter in java
website communicate with app
Mocking an Injected Object's Dependency
Is it possible to invoke enum subclass public method? [duplicate]
HTTP method POST is not supported by this URL in WildFly
Unable to access file from network drive
Improving my greedy Algorithm
How to set java DB property for database location dynamically?
Fixing output of The Huffman Tree