Introduction
RoadRunner replaces PHP-FPM with a Go-based process manager that keeps PHP workers alive between requests. This eliminates per-request bootstrap costs and adds built-in support for HTTP, gRPC, job queues, temporal workflows, and more through a single binary.
What RoadRunner Does
- Serves PHP applications with persistent worker processes
- Eliminates per-request bootstrap overhead by keeping workers alive
- Provides built-in HTTP/2, gRPC, WebSocket, and TCP servers
- Includes a job queue system with drivers for AMQP, Kafka, SQS, and more
- Offers health checks, metrics, and service discovery features
Architecture Overview
RoadRunner is a Go binary that spawns and manages PHP worker processes. Each worker loads the PHP application once and then handles multiple requests over a binary protocol pipe (stdin/stdout or TCP sockets). The Go layer handles networking, TLS termination, load balancing across workers, and plugin execution. Plugins extend RoadRunner with additional capabilities like KV storage, metrics export, and job processing.
Self-Hosting & Configuration
- Download the binary via
vendor/bin/rr getor from GitHub releases - Configure with a
.rr.yamlfile at the project root - Set worker count and memory limits per plugin section
- Enable plugins (http, grpc, jobs, kv) in the YAML config
- Run with
./rr serveand reload workers with./rr reset
Key Features
- Persistent PHP workers eliminate framework bootstrap on every request
- Single binary with HTTP, gRPC, queues, and cron in one process
- Plugin architecture written in Go for extending server capabilities
- Worker memory limit enforcement with automatic restart
- Built-in Prometheus metrics endpoint
Comparison with Similar Tools
- PHP-FPM — spawns new process per request; RoadRunner keeps workers alive for lower latency
- Swoole — PHP C extension with async I/O; RoadRunner uses Go for the server layer and standard PHP workers
- FrankenPHP — embeds PHP in Caddy; RoadRunner uses a separate Go binary with a worker pool model
- Laravel Octane — uses RoadRunner or Swoole as backends; RoadRunner is the underlying server
- Nginx Unit — polyglot app server; RoadRunner is PHP-focused with deeper PHP ecosystem integration
FAQ
Q: Does RoadRunner work with Laravel and Symfony? A: Yes. Laravel Octane supports RoadRunner natively, and Spiral Framework is built specifically for it. Symfony has community adapters.
Q: Do I need to change my PHP code for RoadRunner? A: Most applications work with minimal changes. You need to avoid global state pollution since workers persist between requests.
Q: How does RoadRunner handle memory leaks? A: Workers are automatically restarted after reaching a configurable memory limit or maximum number of requests.
Q: Can RoadRunner replace Nginx? A: RoadRunner can serve HTTP directly but is often placed behind a reverse proxy like Nginx or Caddy for static files and TLS in production.