This is a fork of the thecaliskan/laravel-benchmark project, updated to benchmark Laravel 12 on PHP 8.4.
This fork includes several enhancements:
- Support for the ARM64 architecture (Apple Silicon).
- A PHP-FPM + Nginx service for performance comparison.
- An automation script to run all benchmarks at once.
This benchmark runs on the following stack:
- PHP: 8.4
- Laravel Framework: 12
- Application Servers: OpenSwoole, Swoole, RoadRunner, FrankenPHP
- Traditional Server: Nginx + PHP-FPM
Unlike the original project, this setup requires building the Docker images locally to ensure compatibility with your CPU architecture.
-
Clone the repository:
git clone https://github.com/stephenroque/laravel-benchmark.git cd laravel-benchmark -
Build and run the containers:
docker compose up -d --build
The
--buildflag is essential on the first run to build the custom images.
You can run the tests in two ways:
Use the provided script to run all tests in sequence and save the results to a benchmark.txt file.
-
Make the script executable (only needed once):
chmod +x run_benchmark.sh
-
Run the tests:
./run_benchmark.sh
If you prefer to test each service individually, use the wrk commands below.
wrk -t16 -c100 -d30s --latency http://127.0.0.1:9801/api/health-check
wrk -t16 -c100 -d30s --latency http://127.0.0.1:9801/api/static
wrk -t16 -c100 -d30s --latency http://127.0.0.1:9801/api/http-requestwrk -t16 -c100 -d30s --latency http://127.0.0.1:9802/api/health-check
wrk -t16 -c100 -d30s --latency http://127.0.0.1:9802/api/static
wrk -t16 -c100 -d30s --latency http://127.0.0.1:9802/api/http-requestwrk -t16 -c100 -d30s --latency http://127.0.0.1:9803/api/health-check
wrk -t16 -c100 -d30s --latency http://127.0.0.1:9803/api/static
wrk -t16 -c100 -d30s --latency http://127.0.0.1:9803/api/http-requestwrk -t16 -c100 -d30s --latency http://127.0.0.1:9804/api/health-check
wrk -t16 -c100 -d30s --latency http://127.0.0.1:9804/api/static
wrk -t16 -c100 -d30s --latency http://127.0.0.1:9804/api/http-requestwrk -t16 -c100 -d30s --latency http://127.0.0.1:9805/api/health-check
wrk -t16 -c100 -d30s --latency http://127.0.0.1:9805/api/static
wrk -t16 -c100 -d30s --latency http://127.0.0.1:9805/api/http-request