Thursday, December 26, 2019

What’s the Max Number of Users You Can Test on JMeter?

Actually doesn’t have an exact answer - what’s the maximum number of users you can test on.
Limits usually depend on many factors, and the same goes for JMeter limitations.
JMeter limits depend on the capabilities of
--your machine and network,
--the complexity of your performance scripts,
--the targeted number of simulated users and so forth.

We are going to use a pretty ordinary local machine:

CPU: 1.4 GHz Intel Core i5
RAM: 4GB 1600 MHz

Run Your Load Test for 500 Users
Now let’s try to run the same script with 500 users. Change the number of users in the Thread Groups to 500 threads, and ensure the script ran successfully.

Run Your Load Test for 1,000 Users
A bad thing happened this time. While adding the 743rd user, my JMeter UI application got stuck and stopped responding.

Tip #1: Use JMeter Listeners for Debugging Purposes Only

We clicked the button and…... the script got stuck again. This time I found the script failed while adding the 921st user:

Tip #2: Run JMeter Tests in Non-GUI Mode

To run the test in Non-GUI mode you need to save it as a JMX file (let’s call it ‘JMeterLimitationsTest.jmx’) and execute this specified command:

Let’s run our script and… we can see that test execution went fine without any errors:

Run Your Load Test for 2,000 Users

We are out of memory again. This time it happened after simulating 1,191 users. Can we move further? Of course, the answer is yes! We have lots of useful advice.

Tip #3: Increase JMeter Heap Space to Generate a Larger Load

The JMeter heap has default limits that can be easily increased without any harmful effect for test execution. Just open your JMeter runner script (located in the JMeter bin folder) and replace the value of max heap space (which goes after -Xmx flag) that has these default values:

HEAP="-Xms512m -Xmx512m"
Allocate 2 GB (2048 MB) RAM
HEAP="-Xms512m -Xmx2048m"

Now we can run the same test again with 2,000 users. We clicked the button again and…
We don’t have any out of memory issues anymore but you can see that after we ran almost 2,000 users, we started getting lots of failed requests for our test.

Tip #4: Use LAN instead of Wi-Fi Connections When Running Load Tests

The switch is done, now let’s try to execute the test again. This time the test passed without any issues. We can confirm that a regular laptop can simulate 2,000 users and we should now try to go for the next limitation.

Run Your Load Test for 10,000 Users

We simulated JMeter for more and more threads. As a result, we found that the max value of users we could simulate was around 8000-9000 users. If we added more, we got errors about available memory right after test execution  This time it is not about heap space, but rather based on the limits of my local machine’s RAM.
At this point there might also be many random errors, rendering test execution irrelevant.

n conclusion, we can say that you can simulate up to 10,000 users on a JMeter load test even on a regular laptop. This depends on the following 4 simple rules:

Use JMeter listeners for debugging purposes only
Run JMeter performance tests in non-GUI mode
Increase JMeter heap space to generate a larger load
Use LAN instead of a Wi-Fi connection when running a load test

As you can see, the answer to the question ‘What’s the maximum number of users you can test on JMeter?’ varies. It depends on many factors: test complexity, script running method, internet and machine capabilities and so forth.

I have found the user limit on my local laptop is 8000-9000 users. But what if you need more? There are options to do that:

Distributed mode: JMeter enables running scripts in distributed mode by using a few slave machines with your own main one, and then combining and outputting the results. With this method, you can scripts horizontally without any limitations except for the number of slave machines you allocate for tests.

Cloud solutions: You can also always use cloud solutions. BlazeMeter provides an easy-to-use cloud testing platform, enabling you to run as many users as you wish.

What’s the Max Number of Users You Can Test on JMeter?

Actually doesn’t have an exact answer - what’s the maximum number of users you can test on. Limits usually depend on many factors, and the...