Polyglot Artisan

One Laravel API, rebuilt in Go and Rust: 15× to 195× the successful throughput of classic PHP

A real production API was ported line for line to Laravel Go and Laravel Rust and load-tested against classic Laravel and Laravel Octane, with all four on the same Postgres and Redis. Octane narrowed the gap. Full-text search barely moved, because the database was the bottleneck for every runtime.

31–195×Laravel Rust vs classic Laravel, successful requests per second on 4 clean endpoints
15–155×Laravel Go vs classic Laravel, successful requests per second on 4 clean endpoints
2.5–10×Laravel Octane vs classic Laravel, successful requests per second on 4 clean endpoints
31–67 MBRust memory, against 172–276 MB for classic PHP

The app under test

A production Laravel 13 API, anonymised here. It serves market quotes, price charts, an options calculator and a news feed to several static websites. It also has an admin panel and scheduled data ingestion, but only the API slice below was ported.

Like-for-like ports

Each port runs the same SQL, makes the same Redis calls and returns the same JSON, written idiomatically for its framework. A contract script checks that all four return identical status codes, headers and bodies before any load test.

Shared infrastructure

One Postgres database and one Redis serve all four apps. The PHP app owns the schema and the data; the Go and Rust ports never migrate.

Real middleware

Every API request goes through a Redis fixed-window rate limiter (limits raised for the test). Public reads add CORS headers and a SHA-1 ETag. Keyed routes authenticate a site key with two queries.

ScenarioEndpointWhat it exercises
statusGET /Bare framework overhead: no database, a JSON timestamp
optionsGET /api/v2/calculators/optionsKey auth (2 queries), Black-Scholes and Greeks maths, a large JSON response
quotesGET /api/v2/markets/quotesA Redis snapshot plus market-clock logic for 66 instruments, about 40 KB of JSON
chartGET /api/v2/markets/instruments/{slug}/chartOne indexed database query per request
newsGET /api/v2/news?page=NA count plus a page query and pagination, about 25 KB of JSON
searchGET /api/v2/news?q=…Postgres full-text search, bound by the database
eventsPOST /api/v2/eventsKey auth, then an upsert: a database write on every request

Results

Successful (2xx) responses per second. Longer is better. Endpoints marked ⚠ had failed requests and are left out of the headline.

Measure
Laravel classicLaravel OctaneLaravel GoLaravel Rust

status

Laravel classic528
Laravel Octane5,46710×
Laravel Go81,932155×
Laravel Rust102,816195×

options ⚠

Laravel classic305
Laravel Octane2,0446.7×
Laravel Go9,37731×
Laravel Rust20,20966×

⚠ Left out of the headline. Laravel classic: 76.6% succeeded (1,862 HTTP errors); Laravel Octane: 98.2% succeeded (763 client connection errors). See “Errors in the PHP runs” below.

quotes

Laravel classic402
Laravel Octane9942.5×
Laravel Go5,93315×
Laravel Rust12,77032×

chart ⚠

Laravel classic313
Laravel Octane1,1253.6×
Laravel Go10,46633×
Laravel Rust17,83657×

⚠ Left out of the headline. Laravel classic: 93.4% succeeded (446 HTTP errors); Laravel Octane: 97.3% succeeded (625 client connection errors). See “Errors in the PHP runs” below.

news

Laravel classic274
Laravel Octane1,2824.7×
Laravel Go7,58228×
Laravel Rust11,58842×

events

Laravel classic316
Laravel Octane2,2457.1×
Laravel Go9,45130×
Laravel Rust9,92031×

search

Laravel classic77
Laravel Octane891.2×
Laravel Go991.3×
Laravel Rust1071.4×

Postgres full-text search is the bottleneck here, so every runtime lands within 1.4× of classic PHP. When the database is the limit, a faster language barely helps: add the right index or a search engine first.

Show all numbers, every percentile ▾

Laptop, 50 connections

2026-12-04 · Apple M1 Pro laptop (10 cores, 32 GB); app, Postgres, Redis and load generator on one machine · 50 connections, 20 s per run

ScenarioRuntime2xx/ssent/sp50 msp95 msp99 msmax ms2xxnon-2xxclient errorscut off at endRSS MB
statusLaravel classic52853091133.1162.5258.410,5580048171.6
Laravel Octane5,4675,4707.21557.2230.2109,3570050312.6
Laravel Go81,93281,9350.51.62.410.91,639,002004749.2
Laravel Rust102,816102,8180.50.60.7122,056,716004530.5
optionsLaravel classic305401126.5155.8175.5225.96,1111,862050217.4
Laravel Octane2,0442,08418.941.8145.1462.440,881076350272.4
Laravel Go9,3779,3794.89.914.463.9187,592004781.1
Laravel Rust20,20920,2112.33.34.842.7404,246004839.5
quotesLaravel classic402405108.4214.2252.4334.28,0510048275.5
Laravel Octane99499741.2109167.3301.719,8930050306.1
Laravel Go5,9335,9356.919.928.272.9118,6810050104.8
Laravel Rust12,77012,7733.66.610.644.3255,433005066.6
chartLaravel classic313338145.1190.7220.12996,269446050242.9
Laravel Octane1,1251,15836.396.6158.1293.322,495062550262.1
Laravel Go10,46610,4684.110.414.939.6209,341004872.2
Laravel Rust17,83617,8382.745.228.1356,773005062.3
newsLaravel classic274276171.8239.8418.8773.75,4810050246.9
Laravel Octane1,2821,28430106.5183.1378.825,6330050268.5
Laravel Go7,5827,5845.912.717.447.6151,651005084.4
Laravel Rust11,58811,5904.25.6781.4231,788004861.8
eventsLaravel classic316319143.5240.5273.1367.86,3250050201.4
Laravel Octane2,2452,24718.740.892212.244,9040050226.5
Laravel Go9,4519,4534.99.41233.1189,030005060.7
Laravel Rust9,9209,9224.96.57.918.6198,412005052.2
searchLaravel classic7779614.5902.11049.61272.71,5360050246.7
Laravel Octane8992545.6703.6833.2953.91,7810050225
Laravel Go99102431.11039.61433.42399.11,983005057.5
Laravel Rust107110459.9519.1562.8630.12,141005047.4

PHP re-run of chart and options

2026-12-04 · Same laptop, six minutes later · 50 connections, 20 s per run · Re-ran the two scenarios where PHP returned errors in the main run.

ScenarioRuntime2xx/ssent/sp50 msp95 msp99 msmax ms2xxnon-2xxclient errorscut off at endRSS MB
optionsLaravel classic316328150.2190.1215.9267.76,329181050215
Laravel Octane2,1702,17318.437.8143.2270.743,4140050235.5
chartLaravel classic321333148.7180.9200.1260.26,430192050220.5
Laravel Octane1,2311,23333.891.3154.7255.224,6220050226.1

How it was measured

Read these numbers as relative. The app, the database, Redis and the load generator all shared one laptop. A Laravel Cloud run with four identical environments is planned and will be added here.

Laravel, classic

Laravel 13 on FrankenPHP 1.14 (PHP 8.6.0) without workers, so the app boots on every request as it does under PHP-FPM. Config, route and event caches are on, debug is off.

Laravel Octane

The same branch with Octane 2 on FrankenPHP workers (--workers=auto, 10,000 max requests). The app boots once per worker.

Laravel Go

go.laravel.com v0.2.0 on Go 1.27, built with go build and run as a single binary.

Laravel Rust

laravel-rust 0.2.0 on Axum 0.8 and Tokio, Rust 2024 edition, release build with the mimalloc allocator.

Load

oha with 50 open connections. Each scenario and target got a 5-second warm-up, then 20 seconds of measurement, one at a time. Random path parameters prevent caching. Memory is the server's resident set size right after the run. Throughput counts successful (2xx) responses only. When the 20 seconds run out, oha cancels the requests still in flight (at most one per connection); the full table lists them as “cut off at end”, not as failures.

Reproduce it

Each measured run was oha -z 20s -c 50 --no-tui --rand-regex-url -m GET -H "Accept: application/json" --output-format json URL, after an unmeasured 5-second run with the same flags. The app itself is private, so its code is not published, but every number on this page is downloadable: results as JSON · as CSV. scripts/import-bench.py in the repo turns oha output into this page's data.

Machine

Apple M1 Pro laptop with 10 cores and 32 GB of RAM, run on 4 December 2026. Postgres and Redis ran locally, so database-bound scenarios compete with the app for CPU.

What to take from it

The useful lessons, and the parts not to over-read.

Octane is the cheapest win

Keeping Laravel booted gave 2.5× to 10× more throughput with no code rewrite. Try it before porting anything.

Compiled ports win on CPU and JSON

The gap is widest where PHP spends time booting, computing or encoding JSON: status, options, quotes and chart.

The database sets the ceiling

Full-text search ran at about 80 to 110 requests per second on every runtime. When Postgres is the bottleneck, the language barely matters: fix the query and the indexes first.

Memory follows the model

The Go and Rust binaries stayed at 30 to 105 MB while serving thousands of requests per second. PHP sat at 170 to 310 MB.

Errors in the PHP runs

Classic PHP opens new Postgres and Redis connections on every request. On macOS the closed sockets pile up in TIME_WAIT until the machine runs out of ephemeral ports. In the main run PHP answered 23% of options requests and 7% of chart requests with HTTP 500; a re-run six minutes later still failed about 3% of both. Octane's load generator hit the same port limit as client connection errors in the main run, and its re-run was clean. Both endpoints are flagged ⚠ and left out of the headline. A cloud run on separate machines should remove the problem.

Version 0.2 frameworks

Laravel Rust's first beta came out on 1 December 2026 and Laravel Go's on 2 December; both were days old when this ran on v0.2. Their numbers will move as they mature, and so may Laravel's. The freshness script on this site flags new releases so the page can be re-run.