How to calculate target concurrent users for a JMeter stress test? - jmeter

I want to stress a website and I need to calculate the concurrent users (thread group). I read that there is a rough estimation for this:
No concurrent users = Length of user session / 60 mins * No peak hour
visitors
Google Analytics for this site sets 32K users like historical user limit. So what I did is:
Concurrent Users = 4 / 60 * 32000 = 2133
I have other data such as:
- Think Time: 45 sec.
- Response time: 5 sec.
- Ramp Up: 5000 users/hour.
Should I take Think Time, Response Time and Ramp Up to improve the estimation? How can I do this?

Related

Jmeter - Calculating Ramp-up period

I am trying to send 1100 requests per minute to my API endpoint for a period of 5 minutes, so in total, I will make 5500 requests to the endpoint.
Based on the above requirement, Here is how I have set up my Jmeter:
It seems like I have misconfigured Jmeter, because in the end I can see Jmeter has made 8401 requests to the API instead of 5500.
What have I missed in the configuration?
Does the "Infinite" check-box need to be checked or unchecked?
The number of requests you're expecting (which is 5500) for this test plan is wrong.
As per your expectation, I think, you are making confusion between the Threads and Requests.
Ramp up is the time in which all the users arrive on your tested application server.
Requests are simulated by samplers but threads are the simulation of users.
According to your test plan:
- Total Number of Threads: 1100 vitual users
- Ramp-up time: 60 (1 min)
- Loop count: Infinite
- Test duration: 300 sec (5 min)
- No of requests/sampler in Test Plan: Unknown, assuming it 1
JMeter Execution:
JMeter will kick off those 1100 virtual users in 60 seconds according to the ramp-up time. So, (1100/60)~ 18 users will be active in every second for the first minute of your test. Each thread/user will execute the requests or samplers you have defined in your test plan hierarchy. As you have defined the loop count to infinite, each thread will execute the requests repeatedly until the test finishes. After 60 seconds, all of your 1100 users will be actively hitting those samplers/requests for the remaining 4 mins.
So the total number of requests you will be able to make through JMeter depends on your application response time.
If the avg response time of your requests is 1 second (assuming you have only 1 requests in your test plan), then you will be able to hit total 264000 (264000/240 = 1100 requests per second) for the last 4 mins (when all of your 1100 users are active) of your tests. You can also verify this accordingly by using Active Threads Over Time and Hits Per Second listeners.
So, Please double check the avg response time of your application or the requests/samplers you are using in your test plan.
If you want to control JMeter's throughput to 1100 per minute, you can use a Constant Throughput Timer at your test plan level and use target throughput value as 1100.
Do not forget to add the count of ramp-down time in your test duration. Yes, when you ramp up i.e. in the first minute generally you get more requests as threads are starting. In your case, your test duration should be 7 mins (60 seconds for the ramp-up 1100 users + 300 seconds for 5500 requests + 60 seconds for the ramp down for 1100 users).
You can also check this thread for more : How should I calculate Ramp-up time in Jmeter.
Please note- The total number of requests is related to throughput, Whereas the number of active threads performing the same activity is related to concurrency.
I am trying to send 1100 requests per minutes to my API endpoint for a period of 5 minutes, so in total I will make 5500 requests to the endpoint.
I don't know how you came with this 5500 number but this is not very correct.
Your setup means that:
JMeter will add 18 virtual users each second for 60 seconds
After 60 seconds pass JMeter will run 1100 users for another 4 minutes
The total number of requests JMeter will be able to make will mostly depend on application response time.
If you want to limit JMeter's throughput to 1100 requests per minute consider using Constant Throughput Timer or Precise Throughput Timer
If you don't want to limit JMeter's throughput but want 5500 executions either:
Set "Loop Count" to 5 (but in that case you might fail to get 1100 concurrent users)
Or use Throughput Controller in Total Executions mode so JMeter would stop after executing 5500 requests

150 TPS for 30 users with 50,000 requests in 6 hrs

Suppose we have to achieve 150 TPS for 30 users with 50,000 requests in jmeter where user runs for 6hrs.
I want to hit 3 HTTP request in this scenario.
Can you please suggest how can i configure in such a way?
I have tired to create thread group where users are 25 and duration is 28,800 but i am unable to achieve above part.
I need 150 tps for 50,000 requests in 6hrs
If you want to execute 100 000 requests in 8 hours with 25 users - you need to perform approximately 3.5 TPS. In this case use Constant Throughput Timer to limit the requests execution rate to 208.3 requests per minute
If you want to achieve 150 TPS rate - I doubt you will be able to do this with 25 users (unless response time of your application is 0.16 ms). You might want to allocate more virtual users in order to reach 150 TPS using Concurrency Thread Group and Throughput Shaping Timer combination. However given 150 TPS and 8 hours test duration you will get 4 320 000 requests.
So double check your SLA/NFR as the requirements you listed above are mutually exclusive and cannot be put together.

How to correctly configure number of requests in JMeter?

My performance test strategy is to use JMeter to send 3 different requests to a linux server continually. They are Init, Calculate and Apply.
The number of active users of peak hour is 40 and the number of each request per hour is 200. The load test should be conducted with the peak usage with no less than one hour.
If my understanding is correct, running the test for two hours eventually there will be 1200 samples shown in the result table (200 requests * 3 * 2 hours). However, with the following configuration there are much more samples sent to the server.
Thread Group:
- Number of threads: 200
- Ramp-up time: 3600 seconds
- Duration: 7200 seconds
I have also tried setting the number of threads 50, the result is still far more than my expectation.
May I know how to configure the JMeter correctly ?
Your configuration should be:
Number of threads : 40
Ramp-up time: Should be short in your case, its value tells in how much time threads will go from 0 to 40.
Duration is ok
Finally, as you want 200 requests per hour, which would be 600 for the 3 ones, it would be 10 per minute, you need to use Constant Throughput Timer inside a Test Action:
Where Test Action is :

How do I achieve the expected throughput in JMeter for a given scenario?

I have about 300 users (configured in the thread group) who would perform an activity (e.g.: run an e-learning course) twice. That would mean I need to expect about 600 iterations i.e 300 users performing an activity twice.
My thread group contains the following transaction controllers:
Login
Dashboard
Launch Course
Complete Course
Logout
As I need 600 iterations per 5400 seconds i.e 3600 + 900 + 900 seconds (1 hour steady state + 15 mins ramp-up and 15 mins ramp-down), and the sum of sampler requests within the total thread group are 18, would I be correct to say I need about 2 RPS?
Total number of iterations * number of requests per iteration = Total number of requests
600 * 18 = 10800
Total number of requests / Total test duration in seconds = Requests per second
10800 / 5400 = 2
Are my calculations correct?
In addition, what is the best approach to achieve the expected throughput?
Your calculation looks more or less correct. If you need to limit your test throughput to 2 RPS you can do it using Constant Throughput Timer or Throughput Shaping Timer.
However 2 RPS is nothing more than statistical noise, my expectation is that you need much higher load to really test your application performance, i.e.
Simulate the anticipated number of users for a short period. Don't care about iterations, just let your test to run i.e. for an hour with the number of users you expect. This is called load testing
Do the same but for longer period of time (i.e. overnight or weekend). This is called soak testing.
Gradually increase the number of users until you will see errors or response time will start exceeding acceptable thresholds. This is called stress testing.

web stress and load testing with jmeter - How good is good? benchmark guide?

I am going to set up some load testing test with jmeter.
However, I can't find on the net what is a good bench mark.
How good is good?
My site hit is about 80,000/day on average.
After mining out some data from access log for 1 month, I manage to find out:
Average low traffic is about 1 requests / sec
Average Medium traffic of 30 requests / sec
Average High traffic of 60 requests / sec
I came out with the following plans to test 8 kind of pages and it's ideal respective average response time on a single page load :
Page 1 - 409ms
Page 2 - 730ms
Page 3 - 1412ms
Page 4 - 1811ms
Page 5 - 853
Page 6 - 657ms
Page 7 - 10ms
Page 8 - 180ms
Simulate average traffic scenario - 10 requests / second test
Simulated Users: 10 threads
Ramp Period: 1 sec
Duration: 30 min
Simulate medium traffic scenario - 30 requests / second test
Simulated Users: 30 threads
Ramp Period: 1 sec
Duration: 30 min
Simulate super high traffic scenario - 100 requests / second test
Simulated Users: 100 threads
Ramp Period: 1 sec
Duration: 30 min
Simulate an attack scenario - 350 requests / sec (based on MYSQL max connection of 500)
Simulated Users: 100 threads
Ramp Period: 1 sec
Duration: 10 min
While running these test, I plan to monitor the following:
CPU Load average: (Webserver)
CPU Load average: (DB Server)
RAM Load average:
RAM Load average: (DB Server)
Average Response time:
To see how much it's its memory and cpu utilisation and if there's a need to increase RAM, CPU etc... Also I capped MySQL Max connection at 500.
In all testing, I expect response time should be ideally below a capped benchmark of 10secs.
How does this sound? I've no SLA to follow, this is just based on research on current web traffic and coming out with the plan. The thing is I don't know how what is the threshold of the server. I believe with the hardware below it should already exceed what's needed for hosting our pages.
Webserver is running: 8GB RAM, 4 Core ( 1 server, another cold backup server No load balancer )
MySQL Server is running: 4GB RAM , 2 Core.
We are planning to move to cloud so ideally need to find out what kind of instance best fit our scenario through this load testing as well.
Would really appreciate any good advice here..
Read about SLA
I recommend you to determine your requirements of web-site performance. But by default you can use "standard" response time limit about 10sec.
Next, find user activity profile during day, week, month. Then you could choose base values of load for each profile.
Find most frequent and most "heavy" user actions. Create test scenario with this actions (remember about percent ratio of actions, don't use all actions with one frequency).
Limit load by throughput timer (set needed value of hits per minute). Number of threads in thread group select experimentally (for http load not needed many of them).
Add plugins for jmeter from google-code. Use graphs "number of threads in second", "response time" and standard listener "summary report". Don't use standard graphs with high load, it's too slow. You can also save data to file from each listener (I strongly recommend this, and select csv format). Graphs show average points, so if you want precision pictures then build graphs manually in excel or calc. Grab performance metrics from server (CPU, memory, i/o, DB, net interface).
Set ramp up period about 20-60 minutes and test about 1-2 hours. If all right, then test with 200% load profile or more to find the best performance. Also set test about 1-2 days. So you'll see server stability.

Resources