Skip to content

Raise default max_clients to 16384, add a recv_buffer option - #195

Open
williamthome wants to merge 1 commit into
fix/acceptor-transient-errorsfrom
feat/raise-connection-defaults
Open

Raise default max_clients to 16384, add a recv_buffer option#195
williamthome wants to merge 1 commit into
fix/acceptor-transient-errorsfrom
feat/raise-connection-defaults

Conversation

@williamthome

@williamthome williamthome commented Aug 2, 2026

Copy link
Copy Markdown
Member

Description

Stacked on #196.

max_clients defaulted to 150, which refuses connections long before the VM or the OS is under real pressure. The default moves to 16384. Saturation memory scales as max_clients × recv_buffer, so the socket receive buffer that was hardcoded at 64 KB becomes the recv_buffer listener option, giving a direct lever to trade body-path throughput for per-connection memory rather than forcing the cap back down.

roadrunner:start_listener(api, #{port => 8080, max_clients => 65536, recv_buffer => 16384}, Routes).

The higher default puts the binding limit on the OS rather than the listener: the effective cap is min(max_clients, ulimit -n), and a host left at a 1024 descriptor limit will now reach emfile before reaching max_clients. That is documented on the option, and it is observable rather than silent, since the acceptors emit [roadrunner, listener, accept_error] at the descriptor ceiling and keep accepting (#196). Deployments that want the old behaviour of a clean refusal at a fixed low ceiling can set max_clients explicitly.

max_clients 150 -> 16384, matching the modern BEAM HTTP-server defaults. It is a counter cap, not an allocation, so the higher default costs nothing until connections arrive; the effective cap is min(max_clients, the OS FD limit), so high concurrency needs ulimit -n raised. The hardcoded 64 KB TCP recv buffer becomes the recv_buffer listener opt.
@williamthome
williamthome changed the base branch from main to fix/acceptor-transient-errors August 2, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant