High-performance PHP application server, load-balancer and process manager written in Golang
Clone or download
Latest commit 8533550 Oct 20, 2018
Permalink
Failed to load latest commit information.
cmd no color highlighting for warning messages Oct 14, 2018
service - bugfix: ignored `stopping` value during http server shutdown Oct 18, 2018
src pre-release activities Oct 13, 2018
tests more tests Sep 30, 2018
util improved debug handlers Sep 26, 2018
.gitignore - new directory structure Sep 23, 2018
.travis.yml - go fmt Oct 18, 2018
CHANGELOG.md - bugfix: ignored `stopping` value during http server shutdown Oct 18, 2018
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 - added support for custom env provider Jul 26, 2018
README.md Update README.md Oct 20, 2018
build.sh - bugfix: ignored `stopping` value during http server shutdown Oct 18, 2018
composer.json Update composer.json Oct 20, 2018
config.go default configs Sep 23, 2018
config_test.go fixing some tests Jun 10, 2018
error_buffer.go better static service root directory error Sep 7, 2018
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 bump deps Oct 18, 2018
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 additional event Jun 13, 2018
protocol.go CS Jan 28, 2018
protocol_test.go fixing controlled descruction Jun 5, 2018
server.go better shutdown Jun 23, 2018
server_config.go bugfix: RR_RELAY value fix Sep 30, 2018
server_config_test.go go fmt Oct 1, 2018
server_test.go - new directory structure Sep 23, 2018
socket_factory.go static pool logic update, better watching techniques Jun 12, 2018
socket_factory_test.go golint Oct 1, 2018
state.go no library dependency Jun 11, 2018
state_test.go no more updated Jun 11, 2018
static_pool.go task wait group protection added Sep 23, 2018
static_pool_test.go golint Oct 1, 2018
worker.go error aggregation Jun 23, 2018
worker_test.go golint Oct 1, 2018

README.md

RoadRunner

Latest Stable Version GoDoc Build Status Go Report Card Scrutinizer Code Quality Codecov

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.

Table of Contents

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)
  • fully customizable server
  • flexible environment configuration
  • no external PHP dependencies, drop-in (based on Goridge)
  • load balancer, process manager and task pipeline
  • frontend agnostic (Queue, PSR-7, GRPC, etc)
  • works over TCP, unix sockets and standard pipes
  • automatic worker replacement and safe PHP process destruction
  • worker lifecycle management (create/allocate/destroy timeouts)
  • payload context and body
  • control over max jobs per worker
  • protocol, worker and job level error management (including PHP errors)
  • memory leak failswitch
  • very fast (~250k rpc calls per second on Ryzen 1700X using 16 threads)
  • works on Windows

Example:

<?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:

http:
  address: 0.0.0.0:8080
  workers:
    command: "php psr-worker.php"
    pool:
      numWorkers: 4

License:

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