How to write a PHP Script for the load testing ?
Can you tell me the step to be followed in writing a php script for LOAD Testing ? I have "DOT Net" web application, it can be accessed by more than 100 users at a time. I needs to find the load(performance) of the application when accessed by multiple users at a time. I need a PHP script. Can anybody help me out. Thanks
As in you want to record how many users are accessing the site or you want to record load time of pages on your site?
To record time, record time at the top of your script, record time at the end of your script. Then subtract to find how long it took to load. Here is a tutorial for that:
Then You just need to save the results.. either database or a text file. But do the saving AFTER the end time log. You dont want to count the time to calculate and record.
PHP by itself may not be the best load testing language, as it is (normally) single-threaded. If, for example, you use it to make numerous cURL requests against the site being tested, it will only send one request at a time. For heavier testing involving parallel requests, you might want to look into a language/tool that supports multi-threading and therefore could submit multiple parallel request to the system under test.
A nice little tool I've used in the past and with a good price (free) is Apache JMeter. But, if you are set on doing something in PHP, as mentioned above, start by looking at its cURL extension.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
I wouldn't recommend writing a performance test using PHP as it is pretty much "re-inventing the wheel" action. There is a variety of tools which are designed for performance testing. The best of free ones is Apache JMeter which provides out-of-the-box record and replay functionality, supports headers, cookies, cache, downloading embedded resources, redirects, authentication, parametrization, correlation, etc.
For ASP.NET specifics you might want to see ASP.NET Login Testing with JMeter which highlights the most common problems in details and provides resolutions and best practices.
Thanks . Its easy to work on Apache JMeter tool. Any working guide on Apache JMeter tool. I can able to find the load on any system of any application
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread