Skip to content

stephenroque/laravel-benchmark

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Benchmark (Custom Fork)

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.

🛠️ Stack

This benchmark runs on the following stack:

  • PHP: 8.4
  • Laravel Framework: 12
  • Application Servers: OpenSwoole, Swoole, RoadRunner, FrankenPHP
  • Traditional Server: Nginx + PHP-FPM

🚀 Setup and Execution

Unlike the original project, this setup requires building the Docker images locally to ensure compatibility with your CPU architecture.

  1. Clone the repository:

    git clone https://github.com/stephenroque/laravel-benchmark.git
    cd laravel-benchmark
  2. Build and run the containers:

    docker compose up -d --build

    The --build flag is essential on the first run to build the custom images.


📊 Benchmark

You can run the tests in two ways:

1. Automated Benchmark (Recommended)

Use the provided script to run all tests in sequence and save the results to a benchmark.txt file.

  1. Make the script executable (only needed once):

    chmod +x run_benchmark.sh
  2. Run the tests:

    ./run_benchmark.sh

2. Manual Benchmark

If you prefer to test each service individually, use the wrk commands below.

OpenSwoole

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-request

Swoole

wrk -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-request

RoadRunner

wrk -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-request

FrankenPHP

wrk -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-request

PHP-FPM

wrk -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

About

Laravel Benchmark Example Project for Laravel Octane Servers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • PHP 72.5%
  • Blade 22.0%
  • Dockerfile 2.2%
  • Shell 2.0%
  • Lua 1.1%
  • JavaScript 0.2%