r/PHP • u/roxblnfk • 6h ago
Article Laravel Rust vs PHP: is PHP the bottleneck?
rapira.rsFollow-up to this thread, same setup (1 vCPU per container, Chirper traffic mix). This time the ramp goes up to 5k RPS instead of 2k.
In the original comparison Laravel ran on FrankenPHP and Symfony on Swoole, so the frameworks and the app servers changed at the same time. We added both frameworks on one common base, Rapira. That lets us compare the frameworks on the same app server, and then the same frameworks on different app servers and on Rust.
- On the same app server, Laravel tops out at about 190 RPS and Symfony at about 2,900 RPS. The bottleneck is the framework and its abstractions, not PHP.
- Above 2k RPS both Symfony setups beat Laravel Rust: 3,430 (Swoole) and 2,913 (Rapira) RPS vs 2,638.
- Caddy in front of laravel-rust on 1 vCPU cost 27% of its throughput.
Takeaways
- Profile the framework before rewriting in another language. On this API PHP was not the bottleneck. Switching the app server mostly cut memory and errors under load, not RPS.
- Fit the data layer to the endpoint: fewer queries and no full model hydration where you don't need it.
- Compare runtimes on tail latency, errors under overload and memory, not on a single RPS number.