← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

RoadRunner — Persistent PHP Worker

performance PHP 8.0+ Advanced

Also Known As

RoadRunner persistent PHP PHP worker pool

TL;DR

Go-based server keeping PHP workers alive between requests — eliminating per-request bootstrap cost.

Explanation

RoadRunner manages long-lived PHP workers that bootstrap once (load framework, DI container) and handle multiple requests sequentially. Benefits: eliminates 20-50ms Laravel bootstrap, lower memory per request, WebSocket and gRPC support. Requires stateless PHP code with explicit state reset between requests.

Common Misconception

RoadRunner is a drop-in PHP-FPM replacement — it requires significant changes to handle stateful objects between requests.

Why It Matters

RoadRunner changes PHP's execution model fundamentally — instead of spinning up a fresh PHP process for every request, workers persist and handle multiple requests in sequence. This eliminates bootstrap overhead for frameworks like Laravel and Symfony, which can shave 50–150ms per request. The trade-off is that state must be explicitly reset between requests — static variables, service container state, and in-memory caches persist across requests unless reset, which is a common source of subtle bugs during migration.

Common Mistakes

  • Static properties accumulating between requests
  • DB connections not re-validated
  • Not resetting service container
  • Memory leaks killing workers

Code Examples

✗ Vulnerable
// FPM: 45ms bootstrap on every request
// 1000 requests = 45s in bootstrap alone
✓ Fixed
while ($request = $worker->waitRequest()) {
    $app->resetState();
    $worker->respond($app->handle($request));
}

Added 16 Mar 2026
Edited 23 Mar 2026
Views 135
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 5 pings W 5 pings T 4 pings F 4 pings S 3 pings S 1 ping M 1 ping T 0 pings W 1 ping T
ChatGPT 1
No pings yesterday
ChatGPT 72 Perplexity 24 Amazonbot 14 Google 8 Unknown AI 2 Ahrefs 2
crawler 119 crawler_json 3
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: High
⚡ Quick Fix
Add RoadRunner to your PHP app with composer require spiral/roadrunner — it keeps PHP workers alive between requests eliminating bootstrap cost, giving 3-5x throughput improvement
📦 Applies To
PHP 8.0+ web cli queue-worker laravel symfony
🔗 Prerequisites
🔍 Detection Hints
High PHP-FPM bootstrap cost (heavy framework boot) with pm.max_requests hit frequently; needing WebSocket support in PHP
Auto-detectable: ✗ No blackfire roadrunner
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: Medium ✗ Manual fix Fix: High Context: File Tests: Update

✓ schema.org compliant