What is RoadRunner?
RoadRunner is a high-performance PHP application server and process manager, designed with extensibility in mind through its utilization of plugins. Developed in Go, RoadRunner operates by running your application in the form of workers, where each worker represents an individual process, ensuring isolation and independence in their operation.
It is designed to be like a central processor for PHP applications, helping developers create faster, more responsive and robust applications with ease.
How it works?
RoadRunner efficiently manages a collection of PHP processes, referred to as workers, and routes incoming requests from various plugins to these workers. This communication is done through the goridge protocol, enabling your PHP application to handle requests and send responses back to clients.
The following plugins are designed to run workers and handle specific types of requests:
HTTP - Processes incoming HTTP requests from clients and forwards them to the PHP application.
Jobs - Handles queued tasks received from queue brokers and sends them to a consumer PHP application for processing.
Centrifuge - Manages events from Centrifugo WebSocket server clients and forwards them to the PHP application. It supports bidirectional communication, allowing for efficient and seamless interaction between the server and clients.
gRPC - Deals with gRPC requests from clients and passes them on to the PHP application.
TCP - Handles TCP requests from clients and routes them to the appropriate PHP application.
Temporal - Manages workflows and activities, allowing for the efficient handling of various tasks and processes.
By utilizing these plugins, RoadRunner ensures that your PHP application can effectively handle a wide range of requests and communication protocols, delivering optimal performance and flexibility.
(g)RPC Interface
RoadRunner also provides a customized gRPC interface for communication between the application and the server, which plays a significant role in enhancing the interaction between the two components. This interface is particularly useful when working with the various plugins that support RPC communication, such as:
KV - A cache service that allows for efficient storage and retrieval of cached data.
Locks - Offers a convenient means to manage distributed locks, ensuring resource access coordination across multiple processes or systems.
Service - A dynamic server processes supervisor that enables seamless management of server processes directly from the application.
Jobs - Provides the ability to dynamically manage queue pipelines from within the application, streamlining the execution of tasks and jobs.
Logger - Facilitates the forwarding of logs from the application to the RoadRunner logger, ensuring centralized and efficient log management.
Metrics - Allows for the submission of application metrics to Prometheus, promoting comprehensive monitoring and analysis of application performance.
PHP worker
RoadRunner keeps PHP workers alive between incoming requests. This means that you can completely eliminate bootload time (such as framework initialization) and significantly speed up a heavy application.
Since a worker resides in memory, all open resources persist across requests, remaining accessible for subsequent interactions. Utilizing the built-in goridge, you can offload complex computations to the application server. For instance, you can schedule a background PHP job or even develop your own custom RoadRunner plugin to process complex tasks using Go, which offers improved efficiency and performance. By leveraging the strengths of both PHP and Go, you can create a more robust and high-performance solution for your applications.
It is worth mentioning the following properties of the PHP workers:
Isolation: Each worker process operates independently, preventing interference with other worker processes and improving stability.
Scalability: The shared-nothing architecture makes it easier to scale applications by simply adding more worker processes.
Fault Tolerance: The failure of a single worker does not impact the functioning of other workers, ensuring uninterrupted service.
Simplified Development: By maintaining the isolation of workers, the shared-nothing architecture reduces the complexity of managing shared resources and simplifies the development process.
What's Next?
PHP Workers - Learn how to configure and run PHP workers.
PHP Workers β RPC to RoadRunner - Learn how to use RPC to communicate with PHP applications.
Writing a custom plugin - Learn how to create a custom plugin.
Last updated