Scripts2026年5月19日·1 分钟阅读

RoadRunner — High-Performance PHP Application Server in Go

RoadRunner is a PHP application server written in Go that keeps PHP workers alive between requests, dramatically reducing bootstrap overhead and enabling gRPC, queues, and cron from a single binary.

Agent 就绪

这个资产可以被 Agent 直接读取和安装

TokRepo 同时提供通用 CLI 命令、安装契约、metadata JSON、按适配器生成的安装计划和原始内容链接,方便 Agent 判断适配度、风险和下一步动作。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
RoadRunner Overview
通用 CLI 安装命令
npx tokrepo install 2d9afef1-53c1-11f1-9bc6-00163e2b0d79

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 get or from GitHub releases
  • Configure with a .rr.yaml file 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 serve and 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.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产