Reputation: 4136
How can I test performance of a PHP app using Apache Benchmark?
My environment is Ubuntu Linux - are there packages I can install?
Upvotes: 4
Views: 4050
Reputation: 131811
If you have Apache 2 installed, Apache Benchmark is already installed. See man ab
on how to use it. In most cases its just something like
ab -n 1000 -c 10 http://localhost/path/to/app
Where -n
is the number of all requests, that should be performed and -c
is the number of requests, that should be performed in concurrency.
Note, that you don't test the performance of your php project this way, but test everything, that is affected, beginning with the webserver, PHP, your application, the database, your filesystem, and so on. This means, that if you got poor results, that can also be caused by low memory, or you have just many stuff running in the background, or such. Use a profiler to analyze the performance of a php application. A profiler is built-in within xdebug.
Upvotes: 7