Skip to main content

How to measure the peak number of parallel users with JMeter

How to measure the peak (maximum) number of parallel users supported by your web application? It seems to be a trivial task for JMeter, however it is not so simple.

The main problem is that JMeter doesn't have a built-in feature to identify how Response Time changes with amount of parallel threads. But what if we need to measure this metric in scope of performance testing? There is a nice Response Times vs Threads plugin for JMeter. However this plugin works only with the version of JMeter starting from 2.4 and it is hard to integrate it with Continuous Integration servers. And what if we have the bunch of scripts already implemented for the older 2.3.4 version or just looking for alternative solution that is easier to integrate with our Continuous Integration server? Chronos plugin for Maven would be a good match. Integration of Maven and Chronos with JMeter had been already described in this post

This what I suggest to change in your JMeter script:

  1. In "Thread group" properties set the "Number of Threads" value to 300.
  2. Set "Stop Test Now" behavior in case of Sample error. This will help to avoid excessive requests when your application cannot handle the simulated number of parallel threads anymore.
  3. Set the "Ramp-Up Period" value to 300.
  4. Set "Loop Count" to "Forever" this will simulate constant load produced by parallel users, the number of parallel users will grow +1 each second, until it reaches 300, this will be in 5 minutes.
  5. In "Scheduler" the end time must be 5 minutes after the start time, this will guarantee that the test will end in 5 minutes.

Chronos report will include response time over time graph and the graph that shows the number of active threads. If we compare both graphs we can see what response time corresponds to what number of parallel users. This approach helps us to find the peak number of parallel users that leads to performance degradation where the response time is becoming lower than the acceptable level for our web application. This level can be different for different pages depending on their functionality. This is a simple strategy for JMeter to find the maximum number of parallel users supported by web application. You can play with the configuration a bit, for example you could try to increase ramp-up period, decrease or increase number of threads, this will help you to match the configuration with your test environment.

Popular posts from this blog

Integrating TestRail and Gitlab CI/CD

Perhaps you are using Gitlab CI/CD at your project. Every project requires some test cases for regression testing, and Gitlab actually provides this feature, but it’s only available in Ultimate version that is more expensive. TestRail is another popular platform for managing your test suite that provides way more extensive capabilities and options than Gitlab’s own test case management feature. So the chances are that you are still willing to use TestRail for your acceptance and regression testing efforts. Why not combining the best of two worlds — the flexibility of Gitlab CI/CD and rich test case management capabilities of TestRail? In the following example I’ll demonstrate how this goal could be achieved with ease. Let’s assume that we need to create a new Milestone in TestRail that contains two test runs — the one with Acceptance tests, and another one with Regression tests. The step in your .gitlab-ci.yml Gitlab configuration file would look like this: This step is reading CI

Switching between keyboard layouts in Openbox (Arch Linux)

Switching between two (or more) keyboard layouts in Openbox DE is a task that's quite easy to accomplish, although it might not be so obvious as in other desktop environments. This solution was tested on Arch Linux. You just need to edit this file (assuming you want to switch between English and Ukrainian Phonetic layouts with Alt-Shift): /etc/X11/xorg.conf.d/01-keyboard-layout.conf Section "InputClass" Identifier "keyboard-layout" Driver "evdev" MatchIsKeyboard "yes" Option "XkbLayout" "us,ua(phonetic)" Option "XkbModel" "pc105" Option "XkbOptions" "grp:alt_shift_toggle" EndSection If you have Nvidia card, don't forget to edit /etc/X11/xorg.conf.d/20-nvidia.conf and change Driver from "kbd" to "evdev" in InputDevice section: Section "InputDevice" Identifier "Keyboard0" Driver "evdev" EndSection Y

Solution for com.jcraft.jsch.JSchException: reject HostKey problem on Ubuntu

Just a random investigation with a workaround. So trying to connect to SFTP server using jsch library, but getting a nasty com.jcraft.jsch.JSchException: reject HostKey exception. This host is already present in ~/.ssh/known_hosts file, so it should not be problem, but it is. It turns out this problem happens if SFTP server is running on Ubuntu and strictHostKey is set to true, but it doesn't happen on Linux Fedora. I suppose this is because host entries in the known_hosts file on Ubuntu are encrypted in a different way than in known_hosts on Fedora, so it cannot be recognized or decrypted by JSch library. Now all you need to do is manually add host entries to the file. Basically you just get the public key for the host where SFTP server is running using this command: ssh-keyscan -t rsa sftp_server_ip_address_or_hostname Then copy-paste the output to your local ~/.ssh/known_hosts file. That's all, it should work now. If it doesn't, try to empty known_hosts file complet