feat: per worker max_threads by AlliBalliBaba · Pull Request #1962 · php/frankenphp

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces per-worker max_threads configuration to allow setting absolute thread limits for individual workers, preventing them from consuming all available threads during scaling. This is useful for isolating worker pools, managing extensions, and running multiple domains with separate thread limits.

  • Adds maxThreads field to worker configuration and corresponding validation logic
  • Updates scaling logic to respect per-worker thread limits
  • Adds comprehensive test coverage for thread calculation scenarios with worker-specific limits

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
worker.go Adds maxThreads field to worker struct and implements logic to prevent scaling beyond per-worker limit
scaling.go Updates upscaling logic to check and enforce per-worker max thread limits
phpmainthread_test.go Adds test cases for thread calculation with per-worker max_threads configurations
options.go Adds WithWorkerMaxThreads option function for configuring worker max threads
frankenphp.go Implements validation and calculation logic for worker max_threads in relation to global limits
caddy/workerconfig.go Adds Caddyfile parsing support for max_threads directive in worker configuration
caddy/app.go Wires up worker max_threads configuration to FrankenPHP options
caddy/admin_test.go Updates test to verify auto-scaling respects per-worker max_threads limits

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.