techweb24.dev
README.md

I Ran Laravel's Rust vs Go vs PHP Benchmark Myself: Here Are the Numbers

Laravel Rust vs Laravel Go vs Laravel PHP benchmark results

When Laravel released Laravel Rust and Laravel Go this week, the number everyone repeated was "18x faster than PHP". Laravel published the apps and the k6 load test behind that number, so I ran them myself: the same three Chirper apps (Laravel Rust, Laravel Go and Laravel PHP on Octane), the same request mix and the same 1-CPU limit. Then I gave PHP and Go 4 CPUs to answer the question Laravel's post leaves open: does PHP catch up when it gets more cores?

Short version: on one CPU, Laravel Rust served 98% of the 1.2 million requests the test sent, Laravel Go 86% and Laravel PHP 10%. PHP's best clean rate was 132 requests per second against about 1,990 for Rust, a gap of 15x, close to Laravel's 18x. Giving PHP four CPUs raised it to 658 requests per second, still a third of what Rust and Go managed on one.

What does Laravel's benchmark measure?

Laravel's benchmark post builds one small app, Chirper, in seven frameworks. Each version has the same two JSON endpoints: a paginated feed of short posts (50 per page) and a single post with its author. The database holds 200 posts by 10 authors.

The k6 script sends a fixed mix of reads:

  • 50% the latest page of the feed
  • 20% the next page
  • 10% the previous page
  • 20% a single post

It runs two profiles. Ramp raises traffic from 1 to 2,000 requests per second over 20 minutes and keeps going whether the app copes or not. Steady holds 50 requests per second for 5 minutes. Every request has a 5-second timeout, and the script checks that each response is a valid, gzipped JSON page. The headline number is the best 10-second window in the ramp with no failed requests, no failed checks and no dropped iterations.

Laravel ran each app on a Laravel Cloud instance with 1 vCPU and 4 GiB of memory, with MySQL 8.4 on its own 4 GiB database and k6 on a separate machine. Their results:

FrameworkPeak clean RPSMedian latency at peakMemory
Laravel Rust1,77465 ms179 MB
Rocket (Rust)1,623
Beego (Go)1,596
Laravel Go1,294120 ms380 MB
Rails253
Django183
Laravel PHP (Octane, FrankenPHP)971,995 ms481 MB

Laravel added the Go numbers to the post on 3 December, a day after Laravel Go came out.

How I set up the test

I cloned laravel/laravel-framework-benchmarking-2026 (commit 820bd6c, 3 December 2026) and ran the three Laravel apps in Docker on one machine. The k6 script is unchanged.

Laravel's runMy run
MachineLaravel Cloud instancesApple M4 Pro Mac (12 cores), Docker Desktop
App limit1 vCPU, 4 GiB1 CPU, 4 GiB (then 4 CPUs)
MySQL 8.4Separate serverSame machine, capped at 2 CPUs
k6 2.3.0Separate 2 vCPU machineSame machine, capped at 2 CPUs
gzipCloudflareCaddy reverse proxy (FrankenPHP compresses PHP's large responses itself)
Laravel RustRelease build, Rust 1.99.1, 20 database connections
Laravel GoGo 1.27.4, 40 database connections
Laravel PHPLaravel 13.42, Octane 2.24 on FrankenPHP 1.14.1, PHP 8.5.13, 4 workers (16 at 4 CPUs), config and routes cached
What this setup can't tell you: there is no real network between k6, the apps and MySQL, so latencies are much lower than on a cloud deployment. MySQL shares the machine with the app under test. An Apple M4 core is also faster than a typical cloud vCPU, so compare the apps with each other, not my numbers with Laravel's.

Each app ran on its own, with the other two stopped. Before each run, 200 requests warmed it up so start-up costs weren't counted. docker stats recorded CPU and memory every few seconds.

Steady load: 50 requests per second

All three apps handled the steady profile without a single failed request or check: about 15,000 requests each over 5 minutes.

App (1 CPU)Medianp95p99Average CPULaravel's CPU figure
Laravel Rust2.6 ms5.0 ms7.6 ms4.1%4.2%
Laravel Go3.1 ms6.1 ms8.7 ms5.7%7.2%
Laravel PHP7.1 ms12.1 ms23.8 ms27.9%52.4%

Rust's CPU use matches Laravel's figure almost exactly. PHP needed about half the CPU Laravel measured, probably because an M4 core gets through each request faster than a cloud vCPU, but it still used five to seven times as much CPU as Rust or Go for the same traffic. At this load every app is fast enough that a user would never notice the difference; what you would notice is the server bill.

Ramp to 2,000 requests per second (1 CPU)

The ramp is where the apps separate. Over 20 minutes k6 tries to send about 1.2 million requests. A request counts as served if it comes back within 5 seconds as valid, gzipped JSON. When every k6 worker is stuck waiting on a slow app, k6 skips the request, and those count as missed too.

App (1 CPU)Best clean 10 sMedian / p95 in that windowRequests servedFailedPeak memory
Laravel Rust1,992 req/s0.7 ms / 5.1 ms97.7%1132 MB
Laravel Go1,975 req/s1.0 ms / 548 ms85.9%1,974160 MB
Laravel PHP132 req/s7.3 ms / 923 ms9.5%210,614314 MB
Successful requests per second during the 20-minute ramp for Laravel Rust and Laravel Go on 1 CPU and Laravel PHP on 1 and 4 CPUs

Laravel Rust followed the traffic almost all the way to 2,000 requests per second, with one failed request out of 1.17 million. Its best clean window, 1,992 requests per second, is simply the top of the ramp, so the test never found Rust's limit on this machine. Laravel Go kept pace up to about 1,500 requests per second. Above that it fell behind in bursts: k6 had to skip requests, and about 0.2% of the ones it sent failed. It still had clean 10-second windows near the top, which is why its best figure is almost the same as Rust's. The share of requests served shows the gap better, 98% against 86%.

Laravel PHP fell behind after 80 seconds, at about 130 requests per second. From there the queue only grew: most requests waited the full 5 seconds and timed out, and the median response time across the run was 4.99 seconds. PHP's best clean rate, 132 against Rust's 1,992, is a 15x gap, where Laravel measured 18x (1,774 against 97). Rust reached the top of the ramp before it reached its limit, so on this machine the real gap is at least that.

Does PHP catch up with 4 CPUs?

Laravel's post leaves this open, so I ran the ramp again with four CPUs for PHP (and 16 Octane workers instead of 4) and for Go. I skipped Rust at four CPUs, since it already served the whole ramp on one.

AppBest clean 10 s, 1 CPUBest clean 10 s, 4 CPUsRequests served, 4 CPUs
Laravel Go1,975 req/s1,711 req/s81.0%
Laravel PHP132 req/s658 req/s28.8%

PHP scaled well: four times the CPU gave five times the clean rate, probably helped by the extra workers. It held about 620 to 660 requests per second in good stretches, but it never kept a steady state. It swung between keeping up and timing out every minute or two, and 20% of the requests k6 sent failed. Over the whole run it served 29% of the requests, against 98% for Rust on one CPU.

Go did not get faster with four CPUs, and I wouldn't read much into that. In this run, as in the 1-CPU ones, there were moments when the app, MySQL and the proxy all went quiet at once with no errors. That points to the Mac or Docker's virtual machine pausing, not to the app. One of those pauses hit Go near the top of the ramp. MySQL and k6 were each capped at 2 CPUs, which may also have limited a 4-CPU app. Treat the Go row as "at least as fast as on one CPU".

Laravel Go vs Laravel Rust: which should you pick?

Laravel describes Go as trading a little top-end speed for faster compiles and simpler code, and my numbers agree. At 50 requests per second the two were within half a millisecond of each other, and both used about 5% of a CPU. Up to roughly 1,500 requests per second on one CPU they were just as close. Above that, Rust kept up and Go started to fall behind. Laravel's cloud run found the same order, 1,774 against 1,294.

Go's gain shows up in builds. A clean Docker image build, with the base images already downloaded, took 25 seconds for Laravel Go and 92 seconds for Laravel Rust on the same Mac. You feel that difference every time you deploy or run CI. For most teams the deciding factor will be which language they already know, not the last few hundred requests per second.

Should you move a PHP app to Laravel Rust or Go?

Not for speed alone. If each of your servers handles well under 100 requests per second, PHP is fast enough: at 50 requests per second all three apps answered in single-digit milliseconds. The gain you would notice is CPU: PHP needed five to seven times as much for the same traffic, which on a busy app means fewer or smaller servers.

Against that, both are in beta, with a stable release planned after six to eight weeks of feedback. Packages written for Laravel PHP, such as Nova, Filament and Livewire, don't run on them, and your team would be writing Rust or Go. A new service with heavy, simple read traffic, like a public API or a feed, is the place to try one first. A large existing app with many packages is the last place to move.

How to run this benchmark yourself

You need Docker and about 5 GB of free disk for the images. The repository has the apps and the k6 script but no Docker setup, so these are the files I added. Start by cloning it:

git clone https://github.com/laravel/laravel-framework-benchmarking-2026
cd laravel-framework-benchmarking-2026

1. A Dockerfile for each app

Save each one as Dockerfile in the app's folder. laravel-rust/Dockerfile:

FROM rust:1.99.1-slim
WORKDIR /app
COPY . .
RUN cargo build --release --locked && cp target/release/chirper-laravel-rust /usr/local/bin/
CMD ["chirper-laravel-rust", "serve"]

laravel-go/Dockerfile:

FROM golang:1.27.4
WORKDIR /app
COPY . .
RUN CGO_ENABLED=0 go build -mod=readonly -trimpath -ldflags="-s -w" -o /usr/local/bin/app .
CMD ["app"]

laravel-php/Dockerfile, which caches the config and routes and starts Octane with the worker count from the compose file:

FROM dunglas/frankenphp:php8.5
RUN install-php-extensions pdo_mysql pcntl opcache zip @composer
WORKDIR /app
COPY . .
RUN cp .env.example .env && composer install --no-dev --prefer-dist --optimize-autoloader --no-interaction
CMD ["sh", "-c", "php artisan config:cache && php artisan route:cache && php artisan migrate --force && exec php artisan octane:frankenphp --host=0.0.0.0 --port=8000 --workers=${OCTANE_WORKERS:-4}"]

Build the three images:

docker build -t bench-rust laravel-rust
docker build -t bench-go laravel-go
docker build -t bench-php laravel-php

2. MySQL, the apps and the gzip proxy

Make a bench folder next to the apps and add four files. bench/init.sql creates one database per app. Each app's migrations create the tables and load the 200 posts.

CREATE DATABASE chirper_rust; CREATE DATABASE chirper_go; CREATE DATABASE chirper_php;

bench/.env holds an app key for each app. Generate each one with echo "base64:$(openssl rand -base64 32)":

RUST_KEY=base64:...
GO_KEY=base64:...
PHP_KEY=base64:...

bench/compose.yml caps each app at APP_CPUS CPUs and 4 GB, and MySQL and the proxy at 2 CPUs each:

name: lbench

services:
  db:
    image: mysql:8.4
    environment:
      MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
    volumes:
      - ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
    cpus: 2
    mem_limit: 2g
    healthcheck:
      test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1"]
      interval: 3s
      retries: 40

  rust:
    image: bench-rust
    profiles: ["rust"]
    command: ["sh", "-c", "chirper-laravel-rust migrate --force && exec chirper-laravel-rust serve --host 0.0.0.0 --port 8000"]
    environment:
      APP_ENV: production
      APP_DEBUG: "false"
      APP_KEY: ${RUST_KEY}
      APP_URL: http://localhost:8081
      DB_CONNECTION: mysql
      DATABASE_URL: mysql://root@db:3306/chirper_rust
      DB_MAX_CONNECTIONS: "20"
      LOG_CHANNEL: stderr
      LOG_LEVEL: warning
    cpus: ${APP_CPUS}
    mem_limit: 4g
    depends_on:
      db: { condition: service_healthy }

  go:
    image: bench-go
    profiles: ["go"]
    command: ["sh", "-c", "app migrate --force && exec app serve --host 0.0.0.0 --port 8000"]
    environment:
      APP_ENV: production
      APP_DEBUG: "false"
      APP_KEY: ${GO_KEY}
      DATABASE_URL: mysql://root@db:3306/chirper_go
      DB_MAX_CONNECTIONS: "40"
    cpus: ${APP_CPUS}
    mem_limit: 4g
    depends_on:
      db: { condition: service_healthy }

  php:
    image: bench-php
    profiles: ["php"]
    environment:
      APP_ENV: production
      APP_DEBUG: "false"
      APP_KEY: ${PHP_KEY}
      DB_CONNECTION: mysql
      DB_HOST: db
      DB_DATABASE: chirper_php
      DB_USERNAME: root
      DB_PASSWORD: ""
      LOG_CHANNEL: stderr
      LOG_LEVEL: warning
      OCTANE_SERVER: frankenphp
      OCTANE_WORKERS: ${PHP_WORKERS:-4}
      BENCHMARK_CPU_PROFILE: "false"
    cpus: ${APP_CPUS}
    mem_limit: 4g
    depends_on:
      db: { condition: service_healthy }

  proxy:
    image: caddy:2
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile:ro
    ports:
      - "127.0.0.1:8081:8081"
      - "127.0.0.1:8082:8082"
      - "127.0.0.1:8083:8083"
    cpus: 2
    mem_limit: 512m

bench/Caddyfile gzips every response, like Cloudflare in Laravel's setup, on port 8081 for Rust, 8082 for Go and 8083 for PHP:

{
	admin off
	auto_https off
}
(common) {
	encode {
		gzip
		minimum_length 1
	}
}
:8081 {
	import common
	reverse_proxy rust:8000 {
		header_down -Vary
	}
}
:8082 {
	import common
	reverse_proxy go:8000 {
		header_down -Vary
	}
}
:8083 {
	import common
	# FrankenPHP gzips the feed itself and sends its own single Vary
	reverse_proxy php:8000
}

3. Run k6 against one app at a time

Start MySQL, the proxy and one app. For PHP on one CPU:

cd bench
APP_CPUS=1 PHP_WORKERS=4 docker compose --profile php up -d db proxy php
curl -s --compressed localhost:8083/api/v1/chirps | head -c 200   # check it answers

Then run k6 from the repository root. It shares the proxy container's network, so it can call localhost. Use PROFILE=steady for the 5-minute test or PROFILE=ramp for the 20-minute one, and port 8081, 8082 or 8083 for the app you started:

cd ..
docker run --rm --network container:lbench-proxy-1 --cpus 2 \
  -v "$PWD/k6:/k6:ro" grafana/k6:2.3.0 run \
  -e BASE_URL=http://localhost:8083 -e PROFILE=ramp /k6/benchmark.js

Stop the app before you start the next one (docker compose --profile php stop php), so only one app competes for the CPU. For four CPUs, use APP_CPUS=4 PHP_WORKERS=16.

Three things tripped me up, so check them before a 20-minute run:

  • Every response must be gzipped. Caddy skips responses under 512 bytes by default, and a single post is about 220 bytes, so set minimum_length 1. Otherwise k6 marks every single-post request as failed.
  • k6 reads only one Vary header. Laravel Rust and Laravel Go send their own Vary for CORS, and the proxy adds Vary: Accept-Encoding as a second header. Strip the app's header at the proxy (header_down -Vary).
  • The Host header matters. Laravel Rust and Laravel Go answer 400 Bad Request when the Host doesn't match the app URL, so run k6 against localhost (sharing the proxy container's network) instead of a Docker service name.

FAQ

Is Laravel Rust really 18 times faster than Laravel PHP?

On this test, roughly. Laravel measured 1,774 against 97 requests per second, about 18x. On my Mac with one CPU each, Rust served the whole ramp at up to 1,992 requests per second, against 132 for PHP, so at least 15x. The gap only shows under heavy load. At 50 requests per second both answered in a few milliseconds.

Is Laravel Go faster than Laravel Rust?

No. They were about equal up to 1,500 requests per second on one CPU. Above that, Rust kept up with the traffic while Go started to fall behind, and Laravel's own numbers show the same order (1,774 for Rust, 1,294 for Go). Go's advantages are shorter builds and simpler code.

Did Laravel PHP use Octane in the benchmark?

Yes. Laravel's own run and mine both used Octane with FrankenPHP and 4 workers on PHP 8.5, so the PHP numbers are for a long-running app server, not classic PHP-FPM.

Are Laravel Rust and Laravel Go ready for production?

Not yet. Both are in beta since 1 and 2 December 2026, and Laravel plans a stable release after six to eight weeks of feedback.

Zubaer Ahammed

Full-stack & Android developer from Bangladesh. Builds web platforms and apps and writes practical tutorials here. zubaer.com

Comments