Featured image of post PHP-roadrunner Stress Testing and Configuration Tuning

PHP-roadrunner Stress Testing and Configuration Tuning

PHP-roadrunner stress testing and performance optimization configurations

Pod Configuration

CPUMemory
0.5512M

Testing Tool

Alibaba Cloud PTS

ConcurrencyDurationSourceTest Endpoint
1002 minPublic/api/welcome

Note: 100 concurrency was determined after initial testing as the maximum load the pod could handle without errors (200 concurrency caused significant RT increases).

Service Startup

RoadRunner architecture:

Laravel Octane natively supports RoadRunner. Start the HTTP service with:

php artisan octane:start --server=roadrunner --host=0.0.0.0 --port=8080 --rpc-port=6001 --workers=1 --log-level=warn
--max-requests=50000 --rr-config=/var/www/.rr.yaml

Key Concepts

QPS(TPS) = Total Requests / Time (seconds)
Concurrency (client-side) and QPS (server-side throughput) are not directly correlated.

Test Results

Official recommendations: workers = CPU cores, enable keep-alive for 40% performance gain, set max-requests to 0 or a large value (we used 50000).

WorkersMax RequestsSuccess RateAvg RT(ms)Total RequestsTPS (Avg/Peak)Preview
150000100%1378866572/118
250000100%10901000091/170
450000100%1307904276/133
85000099.16% (OOM & timeouts)2161550146/78
250093.68% (worker recycling)1567750865/174
2 (no opcache)50000100%11181000089/190

Resource Utilization

  • CPU utilization remained stable. Memory increased with more workers.

Final configuration: workers=2 with opcache.enable_cli=0 (saves ~60MB RAM per worker).

Golang Benchmark

For comparison: Go service (0.5vCPU/128MB * 150 pods) performance:

Notes

Results are reference only. Always conduct your own load testing for production configurations.