Reputation: 81
I am attempting to do some loadtesting at work, and they want me to use Visual Studio's load testing. The test asked for is to have 100 logins occur per minute for 30 minutes.
I can see a way to set up a 1 minute duration test where I can have 100 virtual users log in. I can also set up a test for 100 virtual users to log in and have it run 30 times.
So my question is this: Is there a way to meet both of these requirements at one time?
Upvotes: 0
Views: 62
Reputation: 14076
Before really answering this question you need to ask some other questions, such as:
Having created a test script that may include think times, work out how long it takes on average at low loads; let this be T seconds. Work out how many tests one virtual user (VU) can perform in 30 minutes, that is 30*60/T
.
The test spec is "to have 100 logins occur per minute for 30 minutes". This means that 100*30
logins are required in total. We know how many logins one VU can do, so divide the two number to work out how many VUs are needed. The value is (100*30)/(30*60/T)
. Rearranging and simplifying gives T*5/3
.
Example. Suppose a test takes 45 seconds, so T == 45
. Thus we need 45*5/3 == 75
VUs. If we use a constant load pattern this will give 150 logins in the first minutes but only 75 in the second minute, the third minute will have approximately 150 and the fourth approximately 45, and so on. The total averages to 100 per minute, the normal variations in think times and execution times means the load spreads out over time. It may be better to use a stepped load pattern calculated to give 100 tests starting in the first minute. Given the (assumed) 45 second text execution time, if the 75 VUs are started in 45 seconds then 25 of these VUs will finish their test within the first minute and can start another test, thus giving 75+25 tests that start in the first minute. So 75 VUs in 45 seconds is the same as 25 VUs in 15s is the same as 5 VUs in 3s. Hence we could use a stepped load pattern starting with 5 VUs, increasing by 5 VUs every 3 seconds to a maximum of 75 VUs.
Example. Suppose a test takes 6 seconds, so T == 6
. Thus we need 6*5/3 == 10
VUs. If we use a constant load pattern this will give approximately 100 logins in each minutes but, at least initially, the 10 users will be in phase until the normal variations in think times and execution times means the load spreads out over time. Again it may be better to use a stepped load pattern. The simplest I can see is to starting with 1 VU, increasing by 1 VU every (one) second to a maximum of 10 VUs.
Upvotes: 1