Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-18-2008, 03:21 PM   PM User | #1
Bobafart
Regular Coder

 
Join Date: Dec 2006
Posts: 416
Thanks: 168
Thanked 1 Time in 1 Post
Bobafart is on a distinguished road
Stress Testing a Website -- PHP Script

I would like to design a script that stress tests my websites so I can see how they preform under heavy loads (ie. simulate a slashdot load).

I realize there are companies that do they but you have to pay for this.. I am sure I can do something similar in PHP.

How can this be done in PHP? Can someone give me some starting points on how to do it?
Bobafart is offline   Reply With Quote
Old 01-18-2008, 08:49 PM   PM User | #2
Fumigator
UE Antagonizer


 
Fumigator's Avatar
 
Join Date: Dec 2005
Location: Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
Posts: 7,686
Thanks: 42
Thanked 637 Times in 625 Posts
Fumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of lightFumigator is a glorious beacon of light
If you want to just hit the website hard (kind of a denial of service attack but not bad enough to bring down the site), you can use fsockopen() to simply request the page, then put that in a loop.

I think a better exercise would be to use something like the Speed Report available via the Firefox plugin Web Developer (find it under "Tools"), and then trim down the bulk of the page as much as possible, so if the page is requested a lot, it's as light as possible.
__________________
Fumigator is offline   Reply With Quote
Old 01-19-2008, 03:04 AM   PM User | #3
GJay
Senior Coder

 
Join Date: Sep 2005
Posts: 1,791
Thanks: 5
Thanked 36 Times in 35 Posts
GJay is on a distinguished road
apache-bench (the command is 'ab') is pretty easy to use, you can give it a list of urls to hit, either randomly or in order, a concurrency level and either a number of requests or a time limit and it will hit pages for you. You can give it cookies too, so you can login to a site if you need to, it's pretty full-featured.

It gives you the average and slowest times, as well as a breakdown of what percentage of requests were served within particular times and the number of requests per second.
__________________
My thoughts on some things: http://codemeetsmusic.com
And my scrapbook of cool things: http://gjones.tumblr.com
GJay is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:26 AM.


Advertisement
Log in to turn off these ads.