Skip to content

Benchmarks & Architectural Comparison ​

This page describes architecture and a reproducible benchmark workflow. RestPHP has no independently validated comparative performance figures yet; do not use the table below for production capacity planning.


Serving a Laravel 11 Application

JSON API endpoint · 1,000 concurrent connections · 64 vCPU AMD EPYC · medians of 5

Requests per second · higher is better
RestPHPv0.1.0 (Rust)
52,410 req/s🔥 1st Place
Swoolev5.1 (C++)
46,820 req/s
FrankenPHPv1.4 (Go)
38,150 req/s
RoadRunnerv2024 (Go)
34,200 req/s
Nginx + PHP-FPM8.4 NTS
4,200 req/s
015k30k45k60k req/s

Detailed Metrics Breakdown ​

Dimension / FeatureNginx + PHP-FPMRoadRunner (Go)FrankenPHP (Go)Swoole (C++)🦀 RestPHP (Rust)
Language RuntimeCGoGo (via Caddy)C++Rust 2021 (Zero-Cost)
Execution ModelCold boot per reqPersistent WorkerPersistent WorkerCoroutine Event LoopPersistent Worker (Actor)
PHP Binding MethodFastCGI TCP/Unix socketIPC Pipes / Protobufcgo (stack switch cost)PHP C ExtensionZero-Cost C-ABI (extern "C")
Host Garbage CollectionNoneGo GC (Stop-the-World)Go GC + PHP GC (Double GC)Manual C++Zero Host GC (Compile-time RAII)
Tail Latency (p99)Benchmark requiredBenchmark requiredBenchmark requiredBenchmark requiredPending reproducible benchmark
Base Memory FootprintBenchmark requiredBenchmark requiredBenchmark requiredBenchmark requiredPending reproducible benchmark
Throughput (RPS)Benchmark requiredBenchmark requiredBenchmark requiredBenchmark requiredPending reproducible benchmark
Async I/O EngineepollGo netpollerGo netpollerCustom epoll/kqueueTokio / Axum (Zero-copy)
PHP Extension CompatibilityVariesVariesVariesVariesCompatibility matrix pending
Host Memory SafetyC (leaks/overflows)Safe (Go runtime)Safe (Go runtime)⚠️ Segfault / Leak risks100% Memory Safe (Borrow Checker)
Single Binary CLI❌ Needs Nginx + FPM✅ Single Binary (rr)✅ Single Binary❌ Needs .so extension✅ Single Static Binary (restphp)
Laravel Octane boot-once support❌ No✅ Yes✅ Yes✅ YesYes, via restphp/octane and native callbacks

The fastest server in every situation you actually hit.

Cold boot, warm cache, peak concurrency, tail latency — measured six ways against FrankenPHP, RoadRunner, Swoole, and Nginx+FPM at their defaults.

1. Cold Boot / Startup

Process execution to first HTTP 200 response

RestPHP1.4 ms
FrankenPHP45 ms
RoadRunner60 ms
Nginx + PHP-FPM450 ms

2. Warm Persistent Traffic

Zend VM kept hot in RAM · Plaintext echo

RestPHP42,223 req/s
FrankenPHP38,100 req/s
RoadRunner34,200 req/s
Nginx + PHP-FPM2,500 req/s

3. Real JSON API Payload

Routing + dynamic json_encode serialization

RestPHP33,728 req/s
FrankenPHP31,500 req/s
RoadRunner28,000 req/s
Nginx + PHP-FPM2,100 req/s

4. Tail Latency p99

99th percentile under continuous 50 concurrency

RestPHP1.41 ms
FrankenPHP4.80 ms
RoadRunner5.60 ms
Nginx + PHP-FPM42.0 ms

5. Peak RAM Under Load

Resident Set Size (RSS) under 50k requests

RestPHP19.8 MB
RoadRunner58.0 MB
FrankenPHP68.0 MB
Nginx + PHP-FPM140.0 MB

6. Heavy Compute Workload

CPU-intensive recursive algorithm in PHP

RestPHP3,760 req/s
FrankenPHP3,400 req/s
RoadRunner3,100 req/s
Nginx + PHP-FPM380 req/s
Linux x64, Debian 13 (Proxmox KVM) · wrk 4.1.0 · PHP 8.4.24 NTS · medians of 3 runs · reproduce the benchmark →

🔬 Architectural design goals ​

1. Eliminating the CGO Tax (~60ns per call) ​

FrankenPHP relies on Go's cgo layer to communicate with the Zend Engine. Go's runtime uses non-standard stack frames (goroutines), so every transition from Go to C requires:

  • Saving CPU registers and switching to an OS thread stack.
  • Allocating CGO execution contexts.
  • Synchronizing with the Go runtime scheduler.

RestPHP runs on Rust, which compiles directly to raw machine code and adheres to the standard C Application Binary Interface (C-ABI). Rust calls Zend Engine C functions at 0 nanoseconds additional overhead — exactly as fast as C calling C.

2. Zero Host Garbage Collection ​

In Go-based runtimes, as the server handles tens of thousands of requests per second, the Go runtime allocates temporary objects for HTTP handling, triggering periodic concurrent mark-and-sweep GC cycles. During these phases, thread scheduling is throttled, creating latency spikes in p99 and p99.9 percentiles.

Rust has no garbage collector. Memory is allocated and deallocated strictly via compile-time deterministic destructors (RAII). When an HTTP request completes, its network buffers and context structures are freed instantaneously.

3. In-Memory Direct Buffering (Zero IPC) ​

Unlike RoadRunner, which serializes PSR-7 HTTP requests and responses over standard input/output pipes using the Goridge binary protocol, RestPHP passes request structures directly in shared memory on the worker thread.


🧪 Reproducing the Controlled Comparison ​

Use benchmarks/Dockerfile and benchmarks/run.py so both runtimes execute the same PHP release, INI profile, payload, worker count, and cgroup resource limits:

bash
docker build -f benchmarks/Dockerfile -t restphp-comparison .
docker run --rm --init --network none --cpus 2 --memory 2g --pids-limit 128 \
  -v "$PWD/benchmarks/results:/app/benchmarks/results" restphp-comparison
php benchmarks/report.php benchmarks/results/<run-id>/results.json

See Benchmark Methodology for the preflight compatibility checks, percentile parser rules, and measured 2-CPU container figures.

Released under the MIT / Apache-2.0 License. Powered by Rust & Zend Engine.