Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing the performance of a PHP project using Apache Benchmark?

Tags:

php

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

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

like image 901
Sahal Avatar asked Sep 02 '25 05:09

Sahal


1 Answers

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.

like image 166
KingCrunch Avatar answered Sep 04 '25 20:09

KingCrunch