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:
socketare 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.0in the RPC service (unless in Docker).
pipesfor better performance (Unix sockets are just a bit slower).
max_jobsfor your workers if you experience application stability memory issues over time.
OPcachein the CLI with
rrin a cloud environment.
useroption in the
serverplugin configuration to start worker processes from the specified user on Linux-based systems. Note that in this case RoadRunner should be started from the
rootto allow fork-exec processes from different users.
~constworkers latency, you can calculate the number of workers needed to handle the target load.