Swoole vs RoadRunner vs FrankenPHP: Complete PHP 8.5 Application Server Benchmark

In this Swoole vs RoadRunner vs FrankenPHP PHP 8.5 benchmark, we put four application servers to the test. Previously, we compared PHP-FPM, RoadRunner, and FrankenPHP. However, readers immediately asked: “Where’s Swoole?” Today, we answer that question by completing the most comprehensive PHP 8.5 application server comparison ever published.

We tested all four runtimes under identical hardware and PHP configurations. Specifically, we used a real-world Laravel workload. The results are surprising. For instance, RoadRunner achieved 111.6% higher throughput than PHP-FPM. In contrast, Swoole finished last. This finding challenges the common assumption that Swoole is always the fastest option.


Test Environment & Methodology

All tests ran on a single Alibaba Cloud ECS instance. This approach eliminates network variance. The software stack mirrors a typical production environment managed by the Baota panel. For more context, see our first benchmark and our previous application server comparison.

Before adding Swoole to the mix, we first established the performance baseline in our first application server comparison, which tested PHP-FPM, RoadRunner, and FrankenPHP under identical conditions.

Server Specifications

  • OS: Ubuntu 24.04 LTS
  • Web Server: Nginx 1.26 (for PHP‑FPM only)
  • PHP Versions: 8.5.2 (FPM, RoadRunner, Swoole) / 8.5.5 (FrankenPHP built‑in)
  • Database: MySQL 8.4
  • Control Panel: Baota (for convenient PHP‑FPM management)

Swoole vs RoadRunner vs FrankenPHP: Four Environments, One Configuration

EnvironmentPortPHP VersionWorker/Process CountStartup Command
PHP‑FPM808.5.220 (static)Nginx → Unix Socket
RoadRunner80818.5.220rr-server serve -d
FrankenPHP80828.5.520./frankenphp run --config Caddyfile
Swoole80838.5.220 (coroutines)php artisan octane:start --server=swoole

Uniform PHP Configuration

All four environments shared the exact same PHP settings. This guarantees a fair comparison. We kept JIT disabled to isolate runtime architecture impact. JIT is off by default in PHP 8.5. For details on JIT’s effect, see our JIT configuration impact analysis. Furthermore, all environments used the optimal OPcache settings from our OPcache optimization guide.

DirectiveValue
memory_limit256M
opcache.enableOn
opcache.validate_timestampsOff
opcache.memory_consumption512
opcache.jitOff
opcache.jit_buffer_size0
Worker / Process Count20

Test Script

We created a simple route /bench inside a Laravel 11 application. This route simulates a realistic mixed workload:

  • 1,000 sqrt() calculations (light CPU pressure)
  • One SELECT 1 database query (verifies connectivity and adds micro‑I/O)

Load Testing Tool & Parameters

  • Tool: ApacheBench (ab) 2.3
  • Concurrency: 100 (-c 100)
  • Duration: 60 seconds per run (-t 60)
  • Strategy: Each environment ran 3 consecutive rounds. The first round served as a warm‑up and was subsequently discarded. Therefore, the final result is the average of rounds 2 and 3.

Note: We reduced concurrency from 200 (used in our previous test) to 100. PHP‑FPM’s 20‑process pool could not sustain 200 concurrent connections without connection resets. As a result, all four environments were then tested under identical 100‑connection load.


Benchmark Results

EnvironmentAvg RPSAvg P99 (ms)Throughput vs FPM
PHP‑FPM (Baseline)374.62753—
RoadRunner792.41618▲ +111.6%
FrankenPHP375.93127▲ +0.3%
Swoole371.13084▼ -0.9%

Key Takeaways

First, RoadRunner absolutely dominates. It delivered 2.1× the throughput of PHP‑FPM. At the same time, it reduced P99 latency by 41%. This clearly demonstrates the power of a memory‑resident, event‑driven architecture. Laravel boots once per worker and handles thousands of requests without process forking overhead.

In contrast, FrankenPHP performed on par with FPM. This is consistent with our previous findings. However, the HTTP/1.0 limitation of ab continues to mask FrankenPHP’s true potential. Its HTTP/2 and multiplexing capabilities remain untapped in this test.

Most surprisingly, Swoole finished last. Despite Swoole’s reputation as a performance monster, it scored 0.9% lower than plain FPM. Therefore, this result demands a deeper explanation.


Swoole vs RoadRunner vs FrankenPHP: Why Swoole Didn’t Win

However, this does not mean Swoole is a poor runtime. Instead, it reveals a fundamental truth about performance benchmarking. Specifically, workload matters more than raw engine speed.

Understanding Swoole’s Coroutine Model

Swoole replaces PHP’s traditional synchronous I/O with a coroutine-based scheduler. When your code performs a blocking operation, Swoole automatically yields the coroutine. It then switches to another one that is ready to run. For example, a database query triggers this behavior. This feature is called one-click coroutineization. It hooks into PDO, MySQLi, Redis, and cURL automatically. No code changes are required.

Coroutines excel when there is significant I/O wait time to exploit. A query that takes 200ms creates a perfect window. During that time, Swoole can serve dozens of other requests.

Why Our Workload Didn’t Favor Swoole

The SELECT 1 query in our test executes in under 1 millisecond. There is virtually no I/O gap for the coroutine scheduler to fill. In this scenario, the coroutine context switching itself becomes a measurable overhead. This overhead is tiny. However, it is still enough to slightly offset the benefit of memory residence when compared to PHP-FPM.

When Does Swoole Actually Shine?

Swoole’s advantage becomes undeniable when I/O latency increases. Consider these scenarios:

ScenarioTypical I/O LatencySwoole Advantage
Complex database queries50‑500msCoroutine handles other requests during wait
External API calls100‑1000msMassive concurrency gain
File uploads/downloadsSecondsNon‑blocking I/O prevents worker starvation
WebSocket connectionsPersistentNative support, millions of concurrent connections

The RoadRunner Difference

RoadRunner’s advantage comes from a different source. It uses Go’s goroutine scheduler. This scheduler is incredibly efficient even with minimal I/O wait time. Furthermore, RoadRunner combines this with an event‑driven architecture. Laravel boots once per worker. As a result, RoadRunner achieves massive throughput gains without requiring significant I/O latency.


Resource Consumption Observations

We also monitored CPU and memory usage via htop during the benchmark.

  • PHP‑FPM: Maintained exactly 20 processes. Each consumed approximately 30‑50 MB of RAM. Total memory footprint was approximately 600‑1000 MB, the highest of all four.
  • RoadRunner: Used one master process with 20 PHP worker processes. Memory usage per worker was similar to FPM. However, the overall footprint was slightly lower due to shared master process overhead.
  • FrankenPHP: Ran as a single multi‑threaded process. Memory usage was the most compact. This makes it ideal for memory‑constrained containers.
  • Swoole: Used a single master process with internal coroutine workers. Memory footprint was comparable to FrankenPHP. However, CPU usage was slightly higher due to coroutine scheduling overhead under this light workload.

Recommendations for Production

Based on our findings, here is our updated guidance for choosing a PHP 8.5 runtime.

ScenarioRecommended RuntimeReason
Traditional web applicationsPHP‑FPMStable, compatible, battle‑tested
High‑traffic APIs, microservicesRoadRunnerBest all‑around performance, Laravel Octane official support
Containerized, memory‑sensitive deploymentsFrankenPHPSingle‑binary deployment, lowest memory footprint
High‑latency I/O (slow DB, external APIs)SwooleCoroutine architecture handles concurrent I/O wait efficiently
WebSocket, real‑time applicationsSwooleNative WebSocket support, millions of concurrent connections

The performance data in this selection guide is drawn from our comprehensive four-way application server showdown, where we tested each runtime under identical conditions with real Laravel workloads.


Full Reproducibility

At PHPBenchLab, we believe benchmarks should be transparent and repeatable. Below are the exact commands and configurations we used.

Test Endpoints (Publicly Accessible)

  • PHP‑FPM: https://phpbenchlab.com/bench
  • RoadRunner: https://phpbenchlab.com:8081/bench
  • FrankenPHP: https://phpbenchlab.com:8082/bench
  • Swoole: https://phpbenchlab.com:8083/bench

RoadRunner Configuration (.rr.yaml excerpt)

version: '3'
server:
  command: "/www/server/php/85/bin/php worker.php"
http:
  address: 0.0.0.0:8081
  pool:
    num_workers: 20

FrankenPHP Configuration (Caddyfile excerpt)

:8082 {
    bind 0.0.0.0
    root * public/
    php_server {
        env PHP_INI_SCAN_DIR /www/server/php/85/etc
        worker 20
    }
}

Swoole Configuration (Octane start command)

php artisan octane:start --server=swoole --host=0.0.0.0 --port=8083 --workers=20

Benchmark Command (after warm‑up)

ab -c 100 -t 60 https://phpbenchlab.com/bench

Frequently Asked Questions

1. Why is RoadRunner 2.1× faster than PHP-FPM?

RoadRunner avoids two major bottlenecks. First, there is no process forking overhead. Second, Laravel boots only once per worker and reuses that state across thousands of requests. This dramatically reduces CPU and memory waste.

2. Why did Swoole perform worse than PHP-FPM?

Our workload used an extremely fast SELECT 1 query. It executes in under 1 millisecond. Swoole’s coroutine advantage requires significant I/O wait time to shine. In this near‑zero‑latency scenario, coroutine scheduling adds a measurable overhead. This overhead slightly outweighs Swoole’s benefit. For high‑latency I/O loads, Swoole’s advantage can be dramatic.

3. Is the test fair given that FrankenPHP uses PHP 8.5.5 instead of 8.5.2?

Yes. Both versions belong to the same PHP 8.5 branch. They share an identical feature set. We verified core performance configurations across all four environments via phpinfo() output. OPcache, memory limit, and JIT settings were all identical.

4. Why did you use 100 concurrent connections instead of 200?

PHP‑FPM’s 20‑process pool could not sustain 200 concurrent connections. It experienced Connection reset errors. To ensure all four environments could complete the benchmark without errors, we standardized on 100 concurrent connections. This provided a fair and stable testing environment for comparison.

5. Which application server is best for Laravel Octane?

RoadRunner remains the officially recommended and most mature option. It provides first‑party integration, extensive documentation, and a large community. Swoole is also fully supported in Octane. It is the superior choice for high‑latency I/O or WebSocket‑dependent applications.


What’s Next?

This test completed our Swoole vs RoadRunner vs FrankenPHP comparison under a light I/O workload. In future articles, we plan to explore:

  • High‑latency I/O benchmarks: Introducing SLEEP() queries to demonstrate Swoole’s coroutine advantage.
  • HTTP/2 load testing: Using bombardier or wrk to finally unlock FrankenPHP’s true potential.
  • JIT impact across all four runtimes: What happens when we turn on PHP 8.5’s JIT compiler?

Have a specific scenario you’d like us to benchmark? Reach out via our contact page.

Found this article useful? Share it with your team or bookmark PHPBenchLab.com for more data‑driven PHP performance insights.

Leave a Comment