The Developer Day | Staying Curious

Aug/07

21

PHP load testing tool

I needed to test load some of our applications. I’m currently using a windows machine as my workstation. For some weird reason I’ve decided to develop such a load testing tool myself. It was both interesting and fun.

I used php curl extension multi_ functions that are only available since PHP5. The script is very simple. It accepts an integer parameter with max clients and a string parameter where a URL list file resides. You can run the script either from the command line or a browser. The script outputs average client response time, average responses per minute, total amount of responses and time elapsed during test loading. After a client responds the tool requests another URL. You can only stop the tool by killing the process.

You can try my php test loading tool yourself. If you are looking for something more serious try apache ab under Linux or Cygwin.

RSS Feed

10 Comments for PHP load testing tool

Primak | July 20, 2008 at 3:27 AM

Great script! Thank you!

What is the proper way to format the ‘url file’, one url per line, or a comma separated string?

Thank you

Author comment by admin | August 26, 2008 at 2:55 PM

That would be one URL per line and you are welcome.

Karolis | September 24, 2008 at 2:10 AM

Hi,
firstly, great tool, thank you very much.
I have a question though, would it be possible to pass through POST values to the script?

i was thinking of adding a parameter to addClient() and passing it with an extra curl_setopt(). never worked with curl before, so forgive if question is dumb..

Author comment by admin | September 24, 2008 at 11:21 AM

Hi,

No your question is not dumb :) Thanks for asking. Yea it seems your solution could work but it would be limited because every URL you test would pass the same POST arguments.

Have a nice day ;)

Anis uddin Ahmad | November 11, 2008 at 1:40 PM

Thanks a lot.
Great tool

Hemanathagiribabu | March 24, 2010 at 10:17 AM

I am going to test the script for my website. Thanks for your effort.

Chandana | August 20, 2010 at 5:18 AM

Thanks a lot. Keep up the good work. :-)

Szabolcs | March 6, 2011 at 1:32 AM

Great script, thank you for sharing it!

Aditya Singh | December 30, 2011 at 7:41 AM

Oh.. i just began coding my own when i found this out. Thanks, does the job

Sachin | June 11, 2013 at 12:54 PM

Thanks a lot…. Worked for me.

Leave a comment!

<<

>>

Find it!

Theme Design by devolux.org