RoadRunner is a high-performance application server PHP, load balancer, and process manager.
RoadRunner is written in Go, is easy to install, and acts as a replacement for PHP-FPM.
It supports xDebug and its alternatives, as well as profiling and monitoring tools like Datadog and New Relic.
For more details, refer to the documentation of RoadRunner.
For the application to function correctly when launched using this technology, it must be developed with support for asynchronous mode.
In asynchronous mode, the loaded framework configurations, classes, initialized services, and cached data are reused, which significantly accelerates performance.
However, there are distinctive features, such as the need to monitor memory leaks more closely and eliminate blocking operations, and many familiar third-party libraries do not support asynchronous mode.
Storing state in the logical parts of the application becomes undesirable, especially if it is related to a request.
The framework's RollbackInterface is designed for state resetting after each asynchronous request.
To install the server resources for RoadRunner, use the official repository: github.com/roadrunner-server/roadrunner.
For RoadRunner, you will need to modify the file /public/index.php so that the HLEB2 framework operates in a loop.
Here’s a basic working example:
For RoadRunner, you also need to create a configuration file .rr.yaml in the root directory of the project (assuming the compiled server file named rr is located there).
An example of a minimal working configuration in .rr.yaml:
version: '3' server: command: 'php ./public/index.php' http: address: :8088 middleware: - gzip - static static: dir: public forbid: - .php - .htaccess pool: num_workers: 6 max_jobs: 64 debug: false supervisor: max_worker_memory: 5 metrics: address: '127.0.0.1:2113'
In this configuration, RoadRunner limits the operation of a single process (worker) by the maximum allowable memory setting: http.pool.supervisor.max_worker_memory in megabytes. Therefore, if the process exceeds this limit, RoadRunner properly terminates it and proceeds to the next one.
The RoadRunner server is started with the console command:
$./rr serve
According to the configuration, the application will be accessible at the address:
http://localhost:8088
Server metrics in Prometheus format:
http://localhost:2113