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

Discussion of testing theory and practice, including methodologies (such as TDD, BDD, DDD, Agile, XP) and software - anything to do with testing goes here. (Formerly "The Testing Side of Development")

Moderator: General Moderators

Post Reply
akreider
Forum Commoner
Posts: 46
Joined: Mon May 22, 2006 3:54 pm
Location: USA

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

Post 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).
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post 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
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
akreider
Forum Commoner
Posts: 46
Joined: Mon May 22, 2006 3:54 pm
Location: USA

Post 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/
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

Have you tried Flood or ApacheBench?
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post 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 :)
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Post 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
nickvd
DevNet Resident
Posts: 1027
Joined: Thu Mar 10, 2005 5:27 pm
Location: Southern Ontario
Contact:

Post 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...
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Hmm... ab, httperf and Daiquiri were mentioned in Advanced PHP Programming, so it's probably worth taking a look at them.
Post Reply