Page 1 of 1

Speed Testing - How Do I Load the Page 100 Times?

Posted: Sun Oct 22, 2006 4:53 pm
by akreider
I want to test how long a php/mysql generated page takes to load so I can try different configurations and optimize my code.

For instance, I'd like to load it 100 times and get average load times. I'd like to simulate the conditions of a popular browser - IE or Firefox.

Is there any software or script that would help me do this?

I figure I'd want to make sure I'm loading the page, and that I'm NOT using the cache. Also I'd like to be able to automate it (hitting reload 100 times is painful).

Posted: Sun Oct 22, 2006 4:57 pm
by s.dot
here's a simple timing class for you to use: viewtopic.php?t=56775

Also, i don't know about reloading the page 100 times =/ maybe just sections of it to find out where bottlenecks are?

I suppose at the very bottom of the page you could do...

Code: Select all

sleep(1);
header('Location: thispage.php');
exit;
or stick a meta refresh tag in there.

Maybe update a session variable to keep track of pageload times

Posted: Sun Oct 22, 2006 5:02 pm
by akreider
I was actually more interested in total load time, eg not just the php execution time. Though php execution time is one place to start.

Thus I might be looking for some kind of firefox extension or load-tester, that isn't php specific. I figured php developers might know about this though.

I want to load it 100 times to reduce standard deviation. When I load something once, the time is highly variable (sometimes by a factor of 10).

Caching - what is the best way to get rid of this? I read that the nocache html tag might not be cross-browser compatible. I'd like to try it in at least IE 7 and Firefox 1.5.


...

The Load Time Analyzer for Firefox is looking pretty good, for one-time use.
https://addons.mozilla.org/firefox/3371/

Posted: Sun Oct 22, 2006 6:39 pm
by Weirdan
Have you tried Flood or ApacheBench?

Posted: Sun Oct 22, 2006 6:43 pm
by alex.barylski
Write a simple javascript to reload after onload has fired??? Make sure to pull from server not from cache...

Code: Select all

reload(true)
I think the above is how you do that...if not google reload/replace functions and figure it out. Have the javascript refresh an IFRAME or something similar (using frames)???

Cheers :)

Posted: Sun Oct 22, 2006 10:00 pm
by AKA Panama Jack
Actually I use the Microsoft Web Application Stress Test Tool...

Download the Web Application Stress Tool from here

http://www.microsoft.com/downloads/deta ... laylang=en

It will simulate many clients accessing your web site so you can find out how many connections per second a web page can handle. I wouldn't run this on a shared host site because you might get a shutdown warning from overloading the CPU. :) It can send thousands of requests per second to find the upper limit.

I have another box on my home network where I install sites for web stress testing. This gives me no latency for an accurate test.

This is how I came up with the benchmark numbers for my ADOdb Lite database layer.

http://adodblite.sourceforge.net/benchmark.php

Posted: Mon Oct 23, 2006 2:16 am
by nickvd
If you have access to a linux box, there's the 'ab' util...
'nickvd@exile:~$ man ab' wrote:SUMMARY
ab is a tool for benchmarking your Apache Hypertext Transfer Protocol
(HTTP) server. It is designed to give you an impression of how your
current Apache installation performs. This especially shows you how
many requests per second your Apache installation is capable of serv‐
ing.
Designed for testing apache itself, but it should work just fine for php scripts...

Posted: Mon Oct 23, 2006 7:12 pm
by Ambush Commander
Hmm... ab, httperf and Daiquiri were mentioned in Advanced PHP Programming, so it's probably worth taking a look at them.