Workers and operations

Connection capacity

workers.count · "auto"
Starts application workers based on available CPUs, accounting for supported Linux affinity and container quotas. Use a positive integer for a fixed pool. Each worker has its own PHP memory and can be held up by blocking application code.
workers.max_connections · 32
Accepts 1–128 connections per application worker. With two workers at 32, the configured allowance is 64 connections. HTTP/3 pools that allowance across transport processes, capped at 16,384 QUIC sessions. Its TCP companion has a separate allowance. Multiplexed streams have additional admission limits.
workers.listen_backlog · null
Uses the server’s default TCP listen backlog. Set an integer from 1 through 65535 to request a queue size for connections awaiting acceptance. Increasing it leaves the worker pool size unchanged.
workers.user · null
With a root supervisor, specify a dedicated unprivileged account for application workers. Give it access to the application and required storage. Built-in TCP TLS workers also need read access to their serving key and certificate.

Rotation and shutdown

Settings under workers.rotation retire workers as thresholds are reached. The worker drains admitted work while the server replaces it. Setting a request, age or memory threshold to zero disables that trigger independently.

max_requests · 1,000,000
Rotate after this many requests have been served by one worker.
max_age_seconds · 300
Rotate a worker when its age reaches the threshold, even if its request count is low.
max_rss_mib · 0
Set a positive threshold to trigger rotation when resident memory reaches the configured MiB. This initiates retirement and is separate from an OS memory limit.
max_concurrent · 1
Limits simultaneous worker rotations. A value of one staggers replacements.
drain_timeout_seconds · 30
Positive time budget for in-flight work during rotation or shutdown. Work still pending at the deadline can be cancelled. SIGINT and SIGTERM initiate bounded shutdown.

Management socket

control.socket defaults to null. To enable local management, save this profile as server.json and start the server with it. The runtime alias resolves to a private socket for the service account.

JSON
{
  "listen": { "port": 9000 },
  "workers": { "count": 2 },
  "control": { "socket": "@runtime/mini4work.sock" }
}
Shell
php vendor/mini4work/webserver/examples/server.php server.json

In another terminal under the same account, inspect the running server.

Shell
php vendor/mini4work/webserver/examples/control.php @runtime/mini4work.sock status

The client prints JSON status. Substitute restart-workers to request worker replacement or stop to request shutdown. For a custom socket location, the parent directory must belong to the service account and have mode 0700.

Logs and tracing

logging.level defaults to info and includes messages at that severity and above. Choose debug for TLS handshake diagnostics, warning to suppress routine information, or off to disable logging.

observability.apm defaults to off. Choose datadog, newrelic, elastic or opentelemetry after configuring the corresponding CLI agent or SDK. Tracing measures application handler execution. Follow APM tracing to set up a provider and verify your first trace.