Virus In Training


Using AB to benchmark wordpress by mozey
February 14, 2007, 6:23 pm
Filed under: Uncategorized | Tags: ,

Okay people, i often heard the words “Requests Per Second” with respect to a CMS installation on a server. After doing a BIT of work, i learned what tools will allow you to measure that. Which could become very useful if you are trying to see how well your server bEe hIvE under high load.

There are few tools out there, i’m going to talk about one:

AB Which abriviates Apache Benchmark. Very simple command line tool which just does the trick quick, and easy. Here is how i use it.

ab -n 100 -c 5 http://www.example.com

  • -n: Is the number of hits which it will generate.
  • -c: Number of threads which it will run to simulate the number of people.

You can get fancy with this by using the -p switch to specify a file which contains post values. So

ab -n 100 -c 5 -p fancypostfile.txt http://www.example.com

where your fancypostfile.txt looks like this

?action=edit&post=32

?action=delete&post=52

?action=dothis&post=432

Okay, so assume that you would like to add a username and a password authentication. You can do that by using the -A switch like so.

ab -n 100 -c 5 -p fancypostfile.txt -A username:password http://www.example.com

You can also play around with jmeter and grinder as an alternative to AB. But they are probably for more advance use. Unless your doing something of a REALLY large scale, ab will suffice.

UPDATE:

You can run this from any shell promt around the world!, HOWEVER, i recommend using this test on your hosted server machine because it will eleminate the factors of network delays etc and will allow you to evaluate your application more clearly.

You would excecute these commands on your shell accounts. So you would have to have an SSH username/password/server and you would something like Putty to login and excecute these commands (If your a windows user). Another thing i would like to make clear, THIS DOES NOT SPEED UP YOUR APPLICATION. It will simply tell you how fast/slow it is right now!.

Advertisement

3 Comments so far
Leave a comment

for make this test you must go via ssh on directory root? or how?
and this said how is speed the host service?

Comment by rob

I’m sorry, yes these are command lines that you would run on your shell assuming that you have SSH access. You know what!, i’ll just write an update.

Comment by mozey

Note: fancypostfile.txt should not have ?. Question mark causes 302 in in access log, without a question mark, you get 200, with expected content length returned.

Comment by Anonymous




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s



%d bloggers like this: