Restarting Workers

RoadRunner provides multiple ways to safely restart worker(s) on demand. Both approaches can be used on a live server and should not cause downtime.

Stop Command

You are able to send stop command from worker to parent server to force process destruction. In this scenario, the job/request will be automatically forwarded to the next worker.

We can demonstrate it by implementing maxJobs control on PHP end:

ini_set('display_errors', 'stderr');
include "vendor/autoload.php";

$relay = new Spiral\Goridge\StreamRelay(STDIN, STDOUT);
$psr7 = new Spiral\RoadRunner\PSR7Client(new Spiral\RoadRunner\Worker($relay));

$count = 0;
while ($req = $psr7->acceptRequest()) {
    if ($count++ > 1000) {

    try {
        $resp = new \Zend\Diactoros\Response();
        $resp->getBody()->write("hello world");

    } catch (\Throwable $e) {

This approach can be used to control memory usage inside the PHP script.

Full Reset

You can also initiate a rebuild of all RoadRunner workers using embedded RPC bus:

$rpc = new Goridge\RPC(new Spiral\Goridge\SocketRelay("", 6001));
$rpc->call("http.Reset", true);
Edit this page