High-performance PHP application server, load-balancer and process manager written in Golang
Branch: master
Clone or download
Latest commit 3c19236 Feb 14, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd CS Feb 14, 2019
osutil zend factory dependency elliminated Jan 5, 2019
qbuild quickbuilds Jan 11, 2019
service Additional test for 'Content-Type:application/x-www-form-urlencoded; … Feb 2, 2019
src Cleanup PSR7Client from duplicate line Feb 1, 2019
tests __SERVER now support HTTP_... values Jan 17, 2019
util more tests Jan 5, 2019
.gitignore quickbuilds Jan 11, 2019
.travis.yml travis be cool Jan 5, 2019
CHANGELOG.md Update CHANGELOG.md Feb 14, 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 Update Makefile Feb 2, 2019
README.md Update README.md Feb 2, 2019
build.sh version bump Feb 14, 2019
composer.json quickbuilds Jan 11, 2019
config.go default value for numWorkers Feb 14, 2019
config_test.go default value for numWorkers Feb 14, 2019
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 zend factory dependency elliminated Jan 5, 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 second set of patches Jan 5, 2019
protocol.go CS Jan 28, 2018
protocol_test.go fixing controlled descruction Jun 5, 2018
server.go Merge pull request #86 from spiral/qol Jan 10, 2019
server_config.go second set of patches Jan 5, 2019
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

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.

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

Read more in Wiki.

License:

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