0
votes

Im new to Jmaeter and an currently trying to get the best use out of it to create an API performance test plan.

Lets take the following scenario.

We have an APi which returns data such as part availability and order details for a range or parts.

I want to analyse the response times of the api under different load patterns.

Lets say we have 5 users. -Each user sends a series of repeated Requests to the API. -The request made by each user is unique only to that user. i.e User 1 requests parts a,b,c. User 2 requests parts d,e,f... and so on

-All users are sanding their requests at the same time.

The way I have approached this is to create 5 separate thread groups for each user. Within each thread group is the specific http request that gets sent by each user. Each http request is governed by its own loop controller where i have set the number of times for each request to be sent

Since I want all users to be sending their requests at once I have unchecked “run thread groups consecutively” in the main test plan. at a glance the test plan looks something like this: test plan view

Since im new to using Jmeter and performance testing i have a few questions regarding my approach:

  1. Is the way I have structured the test plan suitable and maintainable in terms of increasing the number of users that I may wish to test with? Or would it have been better to have a single thread group with 5 child loop controllers, each containing the user specific request body data?

  2. With my current set up, each thread group uses the default ramp up time of 1 second. I figured this is okay since each thread group represents only one user. However i think this might cause a delay on the start up of each test run. Are there any other potentially better ways to handle this such as using the scheduler or incrementing the ramp up time for each thread group so that they don all start at exactly the same time?

Thanks in advance for any advice

2

2 Answers

0
votes

Your approach is correct.

If you want the requests to be in parallel they will have to be in separate Thread Groups. Each Thread Group should model a use-case. In your case, the use-case is a particular mix of requests.

By running the test for sufficiently long time you will not feel the effects of ramp-up time.

0
votes
  1. First of all your test needs to be realistic, it should represent real users (or user groups) as close as possible. If test does it - it is a good test and vice versa. Something like:

    • If User1 and User2 represent 2 different group of users (like User1 is authenticated and User2 is not authenticated or User1 is admin and User2 is guest) they should go into different Thread Groups.

    • It is better to use Thread Group iterations instead of Loop Controllers as some test elements like HTTP Cookie Manager have settings like Clear Cookies each Iteration which don't respect iterations produced by Loop or While Controller, they consider only Thread Group-driven iterations

    • The only way to guarantee sending requests at the same time is putting them under one Thread Group and using Synchronizing Timer

  2. When it comes to real load test, you should be always gradually adding the load so you could correlate various metrics like response time, throughput, error rate with increased number of virtual users. Same approach should be applied for "ramping-down", you should not be turning off the load at once in order to be able to see how does your application recover after the load. You might want to use some custom Thread Groups available via JMeter Plugins project like:

    They provide flexible and convenient way to set the desired load pattern.