views:

139

answers:

3

I am currently working on some Ajax heavy code and I am wondering how my server will scale as more and more users (hopefully) start to use my web app. It is only on my internal test server for the moment and I was wondering how I would go about simulating a few hundred or thousand users so that I can see how it handles a heavier load. It is written in PHP/MySQL and I really didn't want to find hundreds of computers to set up and test manually :) Thanks in advance, any advice or direction is much appreciated.

+10  A: 

Apache Benchmark. It ships with Apache Web Server. Works kinda like this: For 100 requests using 10 concurrent threads, use this command:

ab -n 100 -c 10 http://localhost/

Replace the localhost url with a url that your AJAX code will be calling. The output will give you a nice report on how the requests were processed. Some of the interesting numbers are:


Complete requests
Failed requests
Requests per second
Asaph
In the same vein as `ab`, there's Tsung - http://tsung.erlang-projects.org/ I've been using and it's a fantastic tool.
inerte
A: 

What I have done, which will give a very rough idea, is to write an application that can create tens or hundreds of threads, and randomly hit the server dozens of times each, with unique users.

So, I had 100 unique test users, and I would create 100 threads and just randomly keep doing some operations at random intervals.

This will tell if you have some scale problems.

Ultimately though, you will have a problem, as you only have one network connection, so that will throttle the speed some, so it isn't perfect.

You can also use junitperf to help with this, as you can then look at whether each test is taking too long to respond.

The best bet is to take these tests, put them on as many machines as you can, and run them at one time, to have 10 computers each pretending to be 10 or 100 people is more effective than having one computer pretend to be each of these people.

You won't want to have the webserver and tests be on the same computer, otherwise that will seriously mess up the results since the webserver will be getting only some of the cpu cycles.

James Black
A: 

Given this problem, I would log a user session. Then write client code that reproduces that set of calls.

Another option would be to use VMware. (note, I'm an employee) Just create a bunch of VMs and connect to your site with each of them. Still means a lot of manual work, but at least you don't need as many machines to do the testing.

clahey