Load Testing. How How Does It Work?

TylerDurden

You Are Not Your Job
Oct 6, 2008
1,191
10
0
Hawaii
A client of ours is requiring that we do load testing on a web application we've built. They need us to do it for 200 users for 8 hours and as far as I can tell by looking online that would cost in the tens of thousands of dollars.

Does anyone have experience with load testing and what companies are good to use for this? What price can I expect to pay?
 


you just need to make sure it doesn't break because of a heavy number of requests? you can automate the average user requests with some scripts, or use something like apache bench to do automated requests to simulate X number of users doing Y number of things
 
Code:
import mechanize, multiprocessing, time

def worker():
    br = mechanize.browser()
    br.open('www.yoursite.com')

sleeps = 0
while True:
    for i in range(200):
        multiprocessing.Process(target=worker).start()

    sleeps = sleeps + 1
    if sleeps > 28800: # 28800s = 8hr
        break
    time.sleep(sleeps)
Also see http://code.google.com/p/multi-mechanize/
 
Oops

Code:
import mechanize, multiprocessing, time

def worker():
    br = mechanize.browser()
    br.open('www.yoursite.com')

sleeps = 0
while True:
    for i in range(200):
        multiprocessing.Process(target=worker).start()

    sleeps = sleeps + 1
    if sleeps > 28800: # 28800s = 8hr
        break
    time.sleep(1)

That shit was about to keep going until the sun burns out :D
 
when they want something load tested, make them be specific about what part needs to be tested, and why.
if they don't have a good answer to that, then make up a bullshit answer and/or fake numbers because they are retard.

in a reasonable scenario, a client would say "i have a specific high-load page that needs to be tested to the peak expected capacities, N requests per minute for Y period of time". the phrasing "200 users for 8 hours" doesn't make any sense, because a "user" is not a unit. 200 users at one page load per minute each? no problem. two hundred concurrent connections for 8 hours? that might be trickier.

p.s. chatmasta your program will take entirely too long to run, because "time.sleep(sleeps)" is not really what you wanted there at all.

Thanks, this is good stuff.
 
when they want something load tested, make them be specific about what part needs to be tested, and why.
if they don't have a good answer to that, then make up a bullshit answer and/or fake numbers because they are retard.

in a reasonable scenario, a client would say "i have a specific high-load page that needs to be tested to the peak expected capacities, N requests per minute for Y period of time". the phrasing "200 users for 8 hours" doesn't make any sense, because a "user" is not a unit. 200 users at one page load per minute each? no problem. two hundred concurrent connections for 8 hours? that might be trickier.

p.s. chatmasta your program will take entirely too long to run, because "time.sleep(sleeps)" is not really what you wanted there at all.

+rep. Perfect answer from many aspects.

To add my 2 cents, if he is asking performance graphs, that is very suspicious and it should make you to thinking.

If the application you developed is not optimized, he might demand compensation for lost revenues. Check the contract to see what happens to that case.

If the application has no such issues, he tries just to show off and any answer lwbco gave is a good one.