RoadRunner
  • 🟠General
    • What is RoadRunner?
    • Features
    • Quick Start
    • Installation
    • Configuration
    • Contributing
    • Upgrade and Compatibility
  • 👷PHP Worker
    • Worker
    • Workers pool
    • Developer mode
    • Code Coverage
    • Debugging
    • Environment
    • Manual workers scaling
    • Auto workers scaling
    • RPC
  • 🟢Customization
    • Building RR with a custom plugin
    • Integrating with Golang Apps
    • Writing a Middleware
    • Writing a Jobs Driver
    • Writing a Plugin
    • Events Bus
  • 🔌Plugins
    • Intro into Plugins
    • Centrifuge (WebSockets)
    • Service (Systemd)
    • Configuration
    • Server
    • Locks
    • gRPC
    • TCP
  • 🌐Community Plugins
    • Intro into Community Plugins
    • Circuit Breaker
    • SendRemoteFile
    • RFC 7234 Cache
  • 🔵App Server
    • Production Usage
    • RoadRunner with NGINX
    • RR as AWS Lambda
    • Docker Images
    • CLI Commands
    • Systemd
  • 🔐Key-Value
    • Intro into KV
    • Memcached
    • In-Memory
    • BoltDB
    • Redis
  • 📦Queues and Jobs
    • Intro into Jobs
    • Google Pub/Sub
    • Beanstalk
    • In-Memory
    • RabbitMQ
    • BoltDB
    • Kafka
    • NATS
    • SQS
  • 🕸️HTTP
    • Intro into HTTP
    • Headers and CORS
    • Proxy IP parser
    • Static files
    • X-Sendfile
    • Streaming
    • gzip
  • 📈Logging and Observability
    • OpenTelemetry
    • HealthChecks
    • Access Logs
    • AppLogger
    • Metrics
    • Grafana
    • Logger
  • 🔀Workflow Engine
    • Temporal.io
    • Worker
  • 🧩Integrations
    • Migration from RRv1 to RRv2
    • Spiral Framework
    • Yii
    • Symfony
    • Laravel
    • ChubbyPHP
  • 🧪Experimental Features
    • List of the Experimental Features
  • 🚨Error codes
    • CRC validation failed
    • Allocate Timeout
  • 📚Releases
    • v2025.1.2
    • v2025.1.1
    • v2025.1.0
    • v2024.3.5
    • v2024.3.4
    • v2024.3.3
    • v2024.3.2
    • v2024.3.1
    • v2024.3.0
Powered by GitBook
On this page
  • Beta notice
  • Introduction
  • Supported plugins
  • Limitations
  • How it works
  • Usage
  • Configuration

Was this helpful?

Edit on GitHub
  1. PHP Worker

Auto workers scaling

Beta notice

This feature is still in beta, errors are expected. Do not use it in production environments.

Introduction

This feature became available starting from the RoadRunner 2024.3 release. Users can now scale their RoadRunner workers automatically, up to 100 additional workers.

Supported plugins

  • All plugins that support workers pool are supported.

Limitations

  • This feature is unavailable when running RoadRunner in debug mode (*.pool.debug=true).

  • This feature does not scale Temporal Workerflow worker, only activity workers.

How it works

RoadRunner uses the pool.allocate_timeout option to determine when to start spawning additional workers. If no workers are available to handle the request at the end of the timeout, RoadRunner begins dynamically allocating additional workers according to the spawn_rate.

Usage

Below is a configuration example demonstrating how to use this new feature:

.rr.yaml
version: '3'

rpc:
  listen: tcp://127.0.0.1:6002

server:
  command: "php worker.php"

http:
  address: 127.0.0.1:10085
  pool:
    num_workers: 2
    allocate_timeout: 60s
    destroy_timeout: 1s
    dynamic_allocator:
        max_workers: 25
        spawn_rate: 10
        idle_timeout: 10s

logs:
  mode: development
  level: debug

Configuration

The new dynamic_allocator section has been added to the *.pool configuration. It contains the following parameters:

  • max_workers - the maximum number of workers that can be additionally spawned.

  • spawn_rate - the number of workers that can be spawned per NoFreeWorkers error (but up to max_workers).

  • idle_timeout - the time after which dynamically allocated workers are considered not needed and would be deallocated.

PreviousManual workers scalingNextRPC

Last updated 4 months ago

Was this helpful?

👷