When utilizing RoadRunner in a production environment, it is important to consider various tips and suggestions to ensure optimal performance and stability.
One crucial aspect to keep in mind is that state and memory are not shared between different worker instances, but they are shared for a single worker instance. As a result, it is essential to take precautions such as closing all descriptors and avoiding state pollution to prevent memory leaks and ensure application stability.
Here are some tips to keep in mind:
socket are the potential point of failure. An easy way to deal with this is to
close all connections after every iteration. Note that this is not the most performant solution.
gc_collect_cyclesafter every execution if you want to keep memory usage low (this will slow down your application a bit).
0.0.0.0 in the RPC service (unless in Docker).
pipes for better performance (Unix sockets are just a bit slower).
max_jobs for your workers if you experience application stability memory issues over time.
OPcache in the CLI with
rr in a cloud environment.
user option in the
server plugin configuration to start worker processes from the specified user on
Linux-based systems. Note that in this case RoadRunner should be started from the
root to allow fork-exec processes
from different users.
~const workers latency, you can calculate the number of workers needed to handle the