logansama Posted February 18, 2009 Share Posted February 18, 2009 Good day, Never dealt with creating automated bots (in php or in any other language) and i dont have experience in stress testing php. But my boss says i must work it out. I have a script which plays a game in itself and stores data in a table. I require to run about 1milion games to check if the maths work out the way they should (gambling maths etc). Php is not that capable to run multiple instances/threads of the script without having grave issues with data access from the tables etc. Was told to look into building a script (php) which would create large volumes of "bot" players which would individually (separate from any other bot created) run the script (thus run a game each). The final result will be many "simultaneous" games played which will result in reaching (hopefully) the 1milion mark rather quickly! Like i said i have no experience in this, but i have a few ideas i am starting on. Any input or tips on where to start looking into this matter would be greatly appreciated. Any experience you wish to share as well! Thank you. Quote Link to comment Share on other sites More sharing options...
gizmola Posted February 18, 2009 Share Posted February 18, 2009 The simplest tool to do stress testing is apache bench which comes with apache. You can set it to call a url using any number of times with any number of seperate processes. For something more complicated, I have seen people develope automated web test scripts using Ruby Watir and Selenium. There are sophisticated automated testing products out there, but of course many of them cost big bucks. Quote Link to comment Share on other sites More sharing options...
logansama Posted February 18, 2009 Author Share Posted February 18, 2009 Thanks for the input. Already started googling the apache bench you mentioned. What i have done as an attempt to "think out the php box" so to speak, is to write a linux script which will manage the starting of many individual "sessions" (each with unique PID) which will each then run the script, providing their independent details. Doing further testing to see if it will work, but like i said, will read up on the apache bench. Thank you. Quote Link to comment Share on other sites More sharing options...
gizmola Posted April 14, 2009 Share Posted April 14, 2009 Sure. Just so you know, Apache Bench can simulate multiple connections so you can save yourself a lot of time. Here's the command line switches just to give you an idea. [david@penny ~]$ ab ab: wrong number of arguments Usage: ab [options] [http[s]://]hostname[:port]/path Options are: -n requests Number of requests to perform -c concurrency Number of multiple requests to make -t timelimit Seconds to max. wait for responses -p postfile File containing data to POST -T content-type Content-type header for POSTing -v verbosity How much troubleshooting info to print -w Print out results in HTML tables -i Use HEAD instead of GET -x attributes String to insert as table attributes -y attributes String to insert as tr attributes -z attributes String to insert as td or th attributes -C attribute Add cookie, eg. 'Apache=1234. (repeatable) -H attribute Add Arbitrary header line, eg. 'Accept-Encoding: gzip' Inserted after all normal header lines. (repeatable) -A attribute Add Basic WWW Authentication, the attributes are a colon separated username and password. -P attribute Add Basic Proxy Authentication, the attributes are a colon separated username and password. -X proxy:port Proxyserver and port number to use -V Print version number and exit -k Use HTTP KeepAlive feature -d Do not show percentiles served table. -S Do not show confidence estimators and warnings. -g filename Output collected data to gnuplot format file. -e filename Output CSV file with percentages served -h Display usage information (this message) -Z ciphersuite Specify SSL/TLS cipher suite (See openssl ciphers) -f protocol Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL) For example, I wanted to test a queuing system that had a memory leak, and used this to hammer it: ab -n 10000 -c 100 http://omittedurl/memqtest.php So that sent 10000 requests across one hundred connections. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.