0
votes

I am using Jmeter to load test my application. My application supports multiple request types and each request type has a rate. I want to load test the application with a predefined rate (qps). This is how I have written my test plan:

I have 1 Thread Group / request type Each Thread group has a HTTP Request and a Constant Throughput Timer defined . The timer defines the rate I want to hit my server with (x/second).

Given this scenario, how significant are the number of threads/users ?

Whats the difference between using 10 threads/users and defining a rate of 100requests/second vs 100 threads/users and defining a rate of 100requests/second ? Is it just thread reuse ? Whats the best practice ?

3

3 Answers

0
votes

In short answer:

Its about concurrency and it depends on the application you're testing. Example: if the AUT is a stateless REST call and all you care is x transactions per sec (tps), the number of users(threads in jmeter terminology) wouldn't matter much as long as you are achieving the target hits. But if it is a web application which requires users to maintain sessions and has a proper contextual user journey, then the concurrent number of users/threads is very important as we can achieve the target with little or more users, it is very important to design the workload according to the NFR.

Here is an article elaborating on the concept. I hope I made sense.

0
votes

You need to calculate the number of users you need

formula to calculate the number of concurrent users to use in your load test:

concurrent_users = (peak_hourly_visits * average_session_duration) / 3600

Basically it depends on the number of users you expect, when you will execute stress test you will try to overload this number of users.

0
votes

By default each JMeter thread executes samplers as fast as it can.

Constant Throughput Timer is used for pausing the threads to slow down overall execution speed to reach the target throughput.

If you have 10 virtual users which can be executed at rate of 10 requests per second you will not be able to reach 20 requests per second without increasing number of users. However you will be able to slow them down to 5 requests per second or 2 requests per second.

If you need to run a request at defined throughput and uncertain how many threads you need there are basically 2 options:

  1. Make sure you provide enough threads in Thread Group. I.e. run your test without any timers and see how does throughput look like using i.e. Aggregate Report listener. If it is higher than needed - you're good to go. If not - add threads unless it will be at least equal or better higher than you need.
  2. Consider the combination of the following JMeter Plugins

    These elements can be joined using Feedback Function so if you define "Target Concurrency" as ${__tstFeedback(jp@gc - Throughput Shaping Timer,100,1000,50)} than JMeter will use initially 100 threads but will be able to automatically add up to 1000 threads if current number of virtual users is enough to maintain the throughput you define in the Throughput Shaping Timer.

You can install both plugins using JMeter Plugins Manager