How to benchmark php/mysql site

user103219 picture user103219 · Dec 2, 2009 · Viewed 15.2k times · Source

I would like to know how to benchmark a php/mysql site.

We have a web app almost completed and ready to go live, we know how many people are going to be using it in a years time but have absolutely no idea how much bandwidth the average user takes, to how much time they burn up on the database etc. We need to determine the correct servers to purchase.

Is there something server side linux that can monitor these statistics per user? So that we can then take this data and extrapolate it?

If I am going about this completely wrong please let me know but I believe that this is a frequent activity for new web apps.

EDIT: I may have asked for the incorrect information. We can see how long the database queries take and how long it takes to load the page but have no idea what load is placed on the server. The question I am asking is can we handle 100 users at once on average...1000? What type of server requirements are needed to hit 1M users. Etc.

Thanks for your help.

Answer

Matt Wheeler picture Matt Wheeler · Dec 3, 2009

A tool that I find fairly useful is jmeter which allows (at it's most basic) you to set your browser to use jmeter as a proxy then you wander all around your website and it will record everything you do.

Once you are happy that it's a decent test of most of your website you can then save the test in jmeter and tell it to run your test with a set number of threads and a number of loops per thread to simulate load on your website.

For example you can run 50 clients each running the testplan 10 times.

You can then ramp the numbers up and down to see the performance impact it has on the site, it graphs the response time for you.

This lets you tune different parameters, try different caching strategies and check the real world impact of those changes.