This project provides a Docker-based benchmarking environment for PHP 8.4, supporting both AMD64 and ARM64 architectures. It uses wrk to stress test common PHP endpoints across varying concurrency levels.
amd64(x86_64)arm64v8(e.g., Apple Silicon, Raspberry Pi)
.
├── Dockerfile.amd64 # Dockerfile for amd64 builds
├── Dockerfile.arm64 # Dockerfile for arm64 builds
├── composer.json # Optional app dependencies
├── public/
│ └── index.php # Landing page and dashboard
├── script/
│ └── run.sh # Benchmark execution script
docker build -f Dockerfile.amd64 -t php-bench:amd64 .docker buildx build --platform=linux/arm64 -f Dockerfile.arm64 -t php-bench:arm64 .ℹ️ Requires Docker Desktop or QEMU for cross-architecture builds.
docker run --rm -p 8080:80 \
-e BENCHMARK_APP_PORT=8080 \
-e CONNECTIONS="1 5 10 20 50 100" \
php-bench:amd64Then, open your browser at: 👉 http://localhost:8080
| Variable | Description | Default |
|---|---|---|
BENCHMARK_APP_PORT |
Port used by the benchmark container (for docs only) | 80 |
CONNECTIONS |
Space-separated list of concurrency levels for wrk | 1 5 10 |
You can set these inline or export before running:
export BENCHMARK_APP_PORT=8080
export CONNECTIONS="1 5 10 100"
docker run --rm -p 8080:80 php-benchAvailable URLs (auto-tested by the benchmark script):
/hello.php/api.php/template_small.php/template_large.php/json_simple.php/json_small.php/json_large.php
When you run the benchmark via:
bash /home/run.shA Markdown file will be created with all results:
/benchmark_results_full_wrk_output.md
/benchmark_results_full_wrk_output_v1.md
/benchmark_results_full_wrk_output_v2.md
...
Each run captures:
- Latency (avg, stdev, max)
- Requests/sec (avg, stdev, max)
- Total requests, duration, and transfer rate
- All concurrency levels defined via
CONNECTIONS
When accessing the container in a browser, the landing page displays:
- PHP version and system architecture
- Dockerfiles (AMD64 + ARM64)
- Benchmark script
- Current environment variables
- Instructions for usage
# Build image
docker build -f Dockerfile.amd64 -t php-bench .
# Run container with custom concurrency
docker run --rm -p 8080:80 \
-e CONNECTIONS="1 5 20 100 1000" \
php-bench
# Inside container, run benchmark
docker exec -it <container_id> bash
/home/run.sh
# View results
cat /benchmark_results_full_wrk_output.mdAll containers are run with --rm so no cleanup is needed. Benchmark results persist only in the running container unless copied out.
- Save results to a mounted volume
- Auto-trigger benchmark from the dashboard
- Export charts or JSON results
- Add request payload types and response times
This benchmark suite was designed to evaluate PHP 8.4 performance across platforms with consistency and transparency.
Feel free to fork and extend!