DEV Community

Cover image for Laravel PHP vs Laravel Go vs Laravel Rust, I ran Laravel's own benchmark on one core each
Fajar Hidayat
Fajar Hidayat

Posted on

Laravel PHP vs Laravel Go vs Laravel Rust, I ran Laravel's own benchmark on one core each

Laravel shipped two new frameworks in two days. Laravel Rust on Dec 1, Laravel Go on Dec 2, both beta. They published numbers for Rust and nothing for Go. the Go announcement only says it gives up "raw top-end speed (barely!)".

"barely" isn't a number, so I ran all three myself. same repo Laravel used for their benchmark, same apps, same k6 script, each app pinned to one core.

TL;DR

  • peak with zero failed requests: Rust 1,825 req/s, Go 1,500 req/s, PHP 86 req/s. Go is ~17x PHP, Rust ~21x.
  • at normal traffic (50 req/s): PHP uses 61% of a core and 256 MB, Go and Rust use under 5% and ~30 MB.
  • build from scratch: Go 39 s, Rust 3 min 47 s. PHP has no compile step, composer install took 6 s.
  • rebuild after touching app code: Go 2.2 s, Rust 1 min 13 s.
  • PHP holds ~45 ms p95 up to ~71 req/s, then breaks: 887 ms at ~91 req/s. Go and Rust stay at 2 to 5 ms there.
  • higher up Rust stays flattest. at ~1,350 req/s p95 is 5.5 ms for Rust and 14.3 ms for Go.

the setup

repo: laravel/laravel-framework-benchmarking-2026 at commit 820bd6c, the one that added the Laravel Go app on Dec 3.

  • laravel-php: Laravel 13 on Octane + FrankenPHP (v1.14.1, PHP 8.6), 4 workers, the config from the repo's README
  • laravel-go: Laravel Go 0.1.1 on Go 1.27.4
  • laravel-rust: Laravel Rust 0.1.0 on Rust 1.99.1
  • the same JSON API in all three, a paginated chirps feed plus a single chirp endpoint
  • the repo's own migrations seed 10 authors and 200 chirps
  • the repo's own k6 script, mix of 50% latest feed, 20% next page, 10% previous page, 20% detail

one VM, 4 cores, split so nothing fights for CPU:

core 0 runs the app (PHP, Go or Rust, one at a time), core 1 runs MySQL 8.4, cores 2 and 3 run k6

# app on core 0, MySQL container on core 1, k6 on cores 2-3
taskset -c 0 ./app serve --host 127.0.0.1 --port 8081
podman run -d --cpuset-cpus=1 -p 127.0.0.1:3306:3306 docker.io/library/mysql:8.4
taskset -c 2,3 k6 run -e BASE_URL=http://127.0.0.1:8081 -e PROFILE=ramp bench-local.js

# PHP the same way, Octane with the README's 4 workers
taskset -c 0 php artisan octane:start --server=frankenphp --workers=4 --port=8083
🏆 ยอดนิยม: fajarhide/laravel php vs laravel go vs laravel rust i ran laravels own benchmark on one core each mf - ประเด็นร้อน 🏆 ยอดนิยม: fajarhide/laravel php vs laravel go vs laravel rust i ran laravels own benchmark on one core each mf - ประเด็นร้อน

two profiles, same as the repo:

  • steady: 50 req/s for 5 min
  • ramp: 1 to 2,000 req/s over 20 min

peak is Laravel's rule: the best 10 second window with zero failed requests.

one change. the k6 script requires gzip responses, which on Laravel Cloud come from the CDN in front of the app. Go and Rust don't compress at all, FrankenPHP does (zstd) when asked. to keep all three on the same footing, every response was uncompressed: the gzip check off for Go and Rust, and Accept-Encoding: identity for PHP. the content checks (valid feed page, correct chirp) stayed on for all three.

peak throughput

peak req/s: Laravel Rust 1,825, Laravel Go 1,500, Laravel PHP 86

Laravel PHP Laravel Go Laravel Rust
peak, best 10 s, 0 failures 86 req/s 1,500 req/s 1,825 req/s
CPU in that window 103% (core full) 101% (core full) 90%
max RAM during the ramp 364 MB 168 MB 122 MB

how each one hits the wall:

PHP is done early. past ~86 req/s the core is full and requests queue until k6's 5 s timeout. most of the 20 minute ramp is timeouts.

Go plateaus. from about minute 14 (~1,450 req/s offered) it serves 1,430 to 1,480 req/s and the rest queues up. only 15 timeouts in the whole run.

Rust keeps up with the offered rate almost to the end, then falls off at ~1,860 req/s with 8,056 timeouts in the last three minutes. I haven't proven whether that wall is the app or MySQL on its single core, so 1,825 is where this setup tops out, not necessarily where Laravel Rust does.

for scale: Laravel's own Cloud run had Rust at 1,774 and PHP at 97, mine are 1,825 and 86. same ballpark, so this box behaves like their setup.

normal traffic

at 50 req/s: CPU PHP 60.8%, Go 4.9%, Rust 3.8%; RAM 256, 34, 29 MB; p95 45.5, 3.6, 2.3 ms

50 req/s for 5 minutes. this is where most apps live.

Laravel PHP Laravel Go Laravel Rust
p50 / p95 / p99 16.4 / 45.5 / 51.0 ms 1.9 / 3.6 / 4.9 ms 1.6 / 2.3 / 3.0 ms
CPU (of 1 core) 60.8% 4.9% 3.8%
RAM 256 MB 34 MB 29 MB
idle RAM 254 MB 22 MB 23 MB

PHP's RAM is two processes, the Octane master and the FrankenPHP server, so it counts some shared pages twice.

all of these are single digit or low double digit ms because app, database and k6 share one machine, no network in the path. compare them to each other, not to numbers from a cloud run.

the part that surprised me: at 50 req/s PHP already uses 61% of its core. Go and Rust sit under 5%. a server bill is mostly paying for that gap.

latency as load climbs

top: p95 at 11 to 111 req/s on a log scale, PHP flat at ~45 ms then 887 ms at 91 and 2,043 ms at 111, Go and Rust flat at 2 to 5 ms. bottom: Go vs Rust p95 at 550, 1,050 and 1,350 req/s, 4.0/6.3/14.3 vs 2.9/3.6/5.5 ms

the first minute of the ramp is where PHP still keeps up, so that's where all three can be compared. p95:

load Laravel PHP Laravel Go Laravel Rust
~11 req/s 44.8 ms 4.1 ms 2.8 ms
~51 req/s 45.7 ms 3.6 ms 2.2 ms
~71 req/s 51.1 ms 3.7 ms 2.1 ms
~91 req/s 886.9 ms 4.4 ms 2.0 ms
~111 req/s 2,042.8 ms 5.3 ms 1.8 ms

PHP is flat until ~71 req/s, then breaks. 20 more requests per second and p95 goes from 51 ms to almost 900 ms. that's what a full core looks like, nothing degrades gently.

from there on it's Go vs Rust:

load Go p50 / p95 / p99 Rust p50 / p95 / p99
~550 req/s 1.3 / 4.0 / 9.8 ms 1.0 / 2.9 / 7.1 ms
~1,050 req/s 1.8 / 6.3 / 12.1 ms 1.1 / 3.6 / 10.9 ms
~1,350 req/s 3.2 / 14.3 / 24.4 ms 1.2 / 5.5 / 17.5 ms

build time and disk

build from scratch: Rust 3 min 47 s, Go 39 s, PHP 6 s; rebuild: Rust 1 min 13 s, Go 2.2 s, PHP none; build disk: Rust 1.3 GB, Go 0.6 GB, PHP 49 MB

all 4 cores, the exact build commands from the repo's README.

Laravel PHP Laravel Go Laravel Rust
from scratch, deps downloaded 6 s (composer install) 39.2 s 3 min 46.5 s
including dependency download (included above) 44.2 s 3 min 49.5 s
rebuild after touching app code none, no compile step 2.2 s 1 min 12.6 s
deploy artifact 49 MB vendor/ + app 32.4 MB binary 32.8 MB binary
build disk 49 MB ~0.6 GB ~1.3 GB

the Laravel Go page says "builds finish in milliseconds". not on this box, 2.2 s was the closest. still, 5x faster than Rust from scratch and 33x on a rebuild. between the two compiled ones, build time is the biggest gap in this whole test, bigger than throughput.

what I'd pick

PHP: biggest ecosystem, no compile, 86 req/s per core. Go: 17x PHP, 39 s build, 2 s rebuild. Rust: 21x PHP, 3 min 47 s build, flattest under load

  • regular web apps, CMSs, stores, a team that already knows Laravel: PHP is still fine. 86 req/s per core is a lot of real traffic, and the ecosystem is years ahead of two betas.
  • the server bill hurts, or you deploy many times a day: Go. most of Rust's throughput at a fraction of the build time.
  • one very hot service where p95 under heavy load is the whole point: Rust.

what this doesn't tell you

  • Go and Rust are beta (0.1.1 and 0.1.0)
  • tiny app, 2 endpoints, 200 rows. Laravel's own post says complex apps will look different
  • one ramp run per framework
  • app, MySQL and k6 on one VM. separate cores, shared memory bus and disk
  • Rust's wall at ~1,860 req/s may be MySQL, not the framework. I didn't profile it
  • all responses uncompressed, which is not how you'd run any of them in production

if you rerun this on other hardware I'd like to see whether the ratios hold. the ratios are the numbers I trust most here.

I share tests like this from my own servers. if you want the next one, follow me here or on X, @fajarhide

Top comments (0)