I am using WebSocket connection in Jmeter, where I am using 2000 number of users in single JMX file. I have copied these JMX files into 5 client machines and triggering the client machines by using bat files. But JMX is getting running smoothly for the first 5 to 10 mins. After some time, I am getting "Java Out of memory error, Unable to create a new thread". I have set proper JVM_ARGS in JMeter.sh file. Does anybody know why this exception is occurring?
2 Answers
The most obvious reason is that your Linux is configured to have i.e. 1024 processes maximum per user, you can check it by running ulimit -u
command. If this is the case - just increase it accordingly.
You may also need to reduce thread stack size using java -Xss option
More information: Troubleshoot OutOfMemoryError: Unable to Create New Native Thread
If you want to run your JMeter test from several machines in parallel you don't need to copy it manually, JMeter supports distributed testing mode so the master will automatically transfer the test plan to the slave machines and collect/aggregate results from them
According to my point of view, this happens because of JMeter consumes all of its default allocated memory. The following are a few solutions as a quick fix for this problem.
Jmter has permission to use the only 512mb of HEAP space by default. Therefore simply increase the size and check as follows. Locate the JMeter bat file (in windows) within your JMeter installed folder and open it with your text editor.
Then Locate this line - HEAP="-Xms512m -Xmx512m"
Now Simply change these amounts according to the requirements.Runs the test cases in CLI mode.
When comes to the GUI mode, It consumes some memory amount for interfaces and other GUI stuff. Using CLI instead you can save some memory amount.Reduce Number Of Listeners You use.
Listeners generate additional overhead within the test plans. Therefore try to choose less number of listers and choose them wisely.