Skip to content
High-performance PHP application server, load-balancer and process manager written in Golang
Go PHP Other
Branch: master
Clone or download
Latest commit b4b1d63 Oct 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin - minor CS in rr script Sep 6, 2019
cmd adds a health service for determining the status of the workers Oct 12, 2019
osutil zend factory dependency elliminated Jan 5, 2019
service - bugfix: do not halt stop sequence in case of service error Oct 22, 2019
src - polishing health service tests Oct 12, 2019
tests fix notice in memleak test Oct 25, 2019
util more tests Jun 24, 2019
.gitignore quickbuilds Jan 11, 2019
.rr.yaml adds a health service for determining the status of the workers Oct 12, 2019
.travis.yml - adding 7.4 tests to Travis Oct 12, 2019
CHANGELOG.md - version bump and release Oct 22, 2019
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md Oct 9, 2018
LICENSE service bus, http service, rpc bus, cli commands, new configs Jun 3, 2018
Makefile - polishing health service tests Oct 12, 2019
README.md Update README.md Sep 16, 2019
build.sh Update build.sh Oct 22, 2019
composer.json - dropped support for 7.1 version Oct 12, 2019
config.go default value for numWorkers Feb 14, 2019
config_test.go default value for numWorkers Feb 14, 2019
controller.go watchers renamed to controllers May 4, 2019
controller_test.go golint May 4, 2019
error_buffer.go base watcher implementation May 2, 2019
error_buffer_test.go better error buffer Jul 9, 2018
errors.go working on tests May 29, 2018
errors_test.go go fmt Jun 7, 2018
factory.go fixing tests Jun 6, 2018
go.mod - version bump and release Oct 22, 2019
payload.go no library dependency Jun 11, 2018
pipe_factory.go breaking the tests Jun 5, 2018
pipe_factory_test.go - new directory structure Sep 23, 2018
pool.go watchers renamed to controllers May 4, 2019
protocol.go miiiinor performance optimizations May 2, 2019
protocol_test.go miiiinor performance optimizations May 2, 2019
server.go golint May 4, 2019
server_config.go second set of patches Jan 5, 2019
server_config_test.go go fmt Oct 1, 2018
server_test.go more tests, watcher tests May 3, 2019
socket_factory.go static pool logic update, better watching techniques Jun 12, 2018
socket_factory_test.go golint Oct 1, 2018
state.go adds a health service for determining the status of the workers Oct 12, 2019
state_test.go no more updated Jun 11, 2018
static_pool.go watchers renamed to controllers May 4, 2019
static_pool_test.go testing watchers May 3, 2019
worker.go Feature: Handle error Jun 29, 2019
worker_test.go golint Oct 1, 2018

README.md

RoadRunner

RoadRunner is an open-source (MIT licensed) high-performance PHP application server, load balancer, and process manager. It supports running as a service with the ability to extend its functionality on a per-project basis.

RoadRunner includes PSR-7/PSR-17 compatible HTTP and HTTP/2 server and can be used to replace classic Nginx+FPM setup with much greater performance and flexibility.

Official Website | Documentation

Features:

  • production-ready
  • PSR-7 HTTP server (file uploads, error handling, static files, hot reload, middlewares, event listeners)
  • HTTPS and HTTP/2 support (including HTTP/2 Push, H2C)
  • fully customizable server
  • flexible environment configuration
  • no external PHP dependencies (64bit version required), drop-in (based on Goridge)
  • load balancer, process manager and task pipeline
  • frontend agnostic (Queue, PSR-7, GRPC, etc)
  • integrated metrics (Prometheus)
  • works over TCP, UNIX sockets and standard pipes
  • automatic worker replacement and safe PHP process destruction
  • worker create/allocate/destroy timeouts
  • max jobs per worker
  • worker lifecycle management (controller)
    • maxMemory (graceful stop)
    • TTL (graceful stop)
    • idleTTL (graceful stop)
    • execTTL (brute, max_execution_time)
  • payload context and body
  • protocol, worker and job level error management (including PHP errors)
  • very fast (~250k rpc calls per second on Ryzen 1700X using 16 threads)
  • integrations with Symfony, Laravel, Slim, CakePHP, Zend Expressive, Spiral
  • works on Windows

Installation:

To install:

$ composer require spiral/roadrunner
$ ./vendor/bin/rr get-binary

Example:

<?php
// worker.php
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));

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

        $psr7->respond($resp);
    } catch (\Throwable $e) {
        $psr7->getWorker()->error((string)$e);
    }
}

Configuration can be located in .rr.yaml file (full sample):

http:
  address:         0.0.0.0:8080
  workers.command: "php worker.php"

Read more in Wiki.

Run:

To run application server:

$ ./rr serve -v -d

License:

The MIT License (MIT). Please see LICENSE for more information. Maintained by Spiral Scout.

You can’t perform that action at this time.