Search code examples
requestjmetertest-plan

Hit 2000 requests in 1 hour, partially from slot 'A' and from slot 'B'


I have been total given 900 URLs (pages) in two slots 'A' and 'B', lets 500+400.

I want to hit 2000 requests in 1 hour, having 80% hit from slot A and 20% from slot B, in the end, I need to share response time.

How I tried:

`**TestPlan**
   -**ThreadGroup-SlotA** - Number of threads=20,Ramp up=2 sec, Loop=1
      -Constant Throughput Timer = 35 (All active threads in current thread group)
      -View Tree Report
      -jp@gc Response Times over Time
   -**ThreadGroup-SlotB** - Number of threads=9, Ramp up=1 sec, Loop=1
      -Constant Throughput Timer = 35 (All active threads in current thread group)
      -View Tree Report
      -jp@gc Response Times over Time`  

I am running it from command line

jmeter -t c:\Users\Admin\Desktop\Jmeter\ThreadAandB.jmx -n -l c:\Users\Admin\Desktop\Jmeter\Reports\Reports.csv -JTEST_RESU
LTS_FILE=c:\Users\Admin\Desktop\Jmeter\Reports\Results.csv

Query:

  1. Does this plan serves this requirement exactly, how to calculate it on paper Users hit X ramp-up time etc?
  2. How to find out how much percentage from which slot have been it? If it doesn't solve requirement how to configure it that meets the requirement from each slot?
  3. Would test end automatically after 1 hour or after 2000 requests? How to make sure that.

Please excuse if you see very silly questions. I am new to Jmeter here.

Edit: Already gone through this one but couldn't figure out how to put it in Jmeter actually. Testing with JMeter: how to run N requests per second

@vins My Comment reached word limit, so putting in my question. Please take a look:

Question 1: I created two thread groups (see question description) inside a test plan and inside those thread groups I have 500 http pages but in your screenshot you have only thread group but two throughput controllers, inside throughput controllers you have http requests. Both approach serve the same purpose?

Question 2: To have 80% requests from first thread group , do we need to feed 80 in percent executions dropdown of throughput controller?

enter image description here

Questions 3: Would it pick http requests randomly or sequentially, I want it to pick randomly, but it was picking sequentially i.e. all 9 users did hit same page and then next 9 users hit next page and so on... but I want every set of 9 users hit random URLs.


Solution

  • Check the sample test plan.

    It can be achieved by Throughput Controller + Constant Throughput Timer

    Constant Throughput Timer - target throughput is set to 34 / min to achieve 2000 requests / hour.

    When the total was no of requests was 550, Slot A was 440 and Slot B was 110. 80/20 worked very well.

    enter image description here

    Update:

    1. Please note that you might not have exactly 2000 requests / hour. JMeter will try to achieve that. Mostly in that range. Minimum 2000/hr. (I set the target throughput as 34 / min. JMeter did 34.1 / min) If your application is not capable of processing those many requests in 1 hr, Obviously JMeter can not send 2000 requests.

    2. You can set the duration of the threadgroup to 3600 to stop automatically after 1 hour. Set the loop count to forever. OR the let the loop count be 2000 . JMeter will stop the test automatically either the time elapses or count reached.

    3. If the 2000 requests / hr is overall throughput of the server, no of users for the thread group does not seem to really matter. You can even achieve this with 1 user. (i do not know about your application - so start with few users first. If you are unable to get 2000 / hr, then add more users)

    4. You do not need 2 thread groups. [May be i have not understood question fully]. Lets assume you have 2 sets of URLs. Lets maintain them in 2 different CSV files. With 2 CSV configs, We can ensure that one URL is hit by only one user.

    Sample Test Plan uploaded here.