Laravel Rust vs Laravel PHP: I repeated the official benchmark on Hetzner ↗
Ran Laravel's apps and k6 script byte for byte on rented Hetzner servers, and added PHP-FPM. Rust served 11 to 13 times what Octane did on every server, and it was the only stack that never dropped a request on a 1 GB box.
| Stack | req/s |
|---|---|
| Laravel Rust | ≥ 1,991 req/shit the load cap |
| Octane | 167 req/s |
| PHP-FPM | 92.5 req/s |
| Stack | req/s |
|---|---|
| Laravel Rust | 1,013 req/s |
| Octane | 90.3 req/s |
| PHP-FPM | 61.9 req/s |
| Stack | % |
|---|---|
| Laravel Rust | 0 |
| Octane | 66.7% |
| PHP-FPM | 97.6% |
| Stack | MiB |
|---|---|
| Laravel Rust | 6.7 MiB |
| Octane | 88.9 MiB |
| PHP-FPM | 27.9 MiB |
Setup
- Hetzner, Helsinki. App limited to 1 dedicated vCPU and 4 GiB, MySQL 8.4 on its own server, k6 on a third.
- Also a €7 VPS with 2 shared vCPU, then the same VPS booted with 1 vCPU and 961 MiB.
- Laravel Rust 0.1.0; FrankenPHP 1.13.6 with PHP 8.5; nginx with PHP-FPM 8.5, OPcache on.
Keep in mind
- Plain HTTP on a private network, so latencies are not comparable with Laravel Cloud, which adds TLS and an edge.
- On the 1 GB box the kernel ran out of memory three times during PHP runs and killed MySQL each time. It never happened during a Rust run.
- One region, one day, one small API.