4

How can I test performance of a PHP app using Apache Benchmark?

My environment is Ubuntu Linux - are there packages I can install?

1 Answer 1

7

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Whenever i try in browser, i get 100 warnings that will be logged. But when i ran ab command with 1000 request, it should log 100 * 100 entry in my log file. It is not happening. Can you help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.