Linux UDP receive sysctl reference
Tune every Linux network sysctl on the normal high-rate IPv4 UDP receive path with defaults, receiver values, and parameter-specific failure modes.
Baseline assumptions
The recommended column targets a dedicated receiver and provides a starting configuration for testing. Validate it against packet rate, burst behavior, latency, and drops measured on the deployed kernel, NIC, driver, namespace, and workload.
Linux defaults below are upstream defaults where one fixed value exists. A distribution, kernel configuration, boot-time memory calculation, container runtime, or loaded module can change the active value. Read every deployed value before applying a change.
Socket memory
Raise the host receive-memory ceiling before socket creation. The process then requests SO_RCVBUF and reads back the effective amount. Linux commonly exposes twice the requested value because of socket accounting, so 4,194,304 requested bytes can appear as 8,388,608.
Input backlog and NAPI budgets
For every softnet_stat row under /proc/net, read fields two and three as deltas. A backlog setting cannot repair NIC-ring drops, and a socket-buffer setting cannot repair an earlier softnet drop.
Busy polling
Busy polling requires support across the kernel, driver, NAPI association, privileges, and socket configuration. SO_BUSY_POLL_BUDGET and epoll's busy_poll_budget field are not sysctls, so they remain outside the table. A value without a compatible NAPI path changes nothing. Measure p50, p99.9, CPU, softnet counters, socket drops, and decode age together.
Steering and timestamp placement
RPS and RFS also require per-queue sysfs masks and flow counts, outside sysctl. Given sufficient NIC hardware queues, one critical UDP tuple normally benefits more from stable flow affinity than software movement between CPUs.
IPv4 demultiplexing and fragments
Do not raise fragment thresholds to conceal an MTU failure. An ordinary 1,500 bytes of path MTU carries the documented UDP maximum without fragmentation under usual IPv4 and UDP headers.
Reverse-path filtering
Mode 0 disables reverse-path checks, mode 1 is strict, and mode 2 is loose. Before selecting one, test both the receiving interface and its actual route back toward 203.23.178.228.
Conntrack, when loaded
Conntrack sysctls exist only when that subsystem is present inside the namespace. A stable feed tuple uses about one entry, while packet rate determines lookup work. On a non-NAT receiver with a narrow stateless firewall, an early notrack rule can remove feed traffic from conntrack instead of tuning a global table around one flow.
Apply changes as experiments
Change a single receive-path layer per experiment. Reboot or recreate the namespace when testing persistence. Record kernel release, active values, NIC and driver, queue mapping, receiver build, packet distribution, loss counters, CPU, and latency before and after.
Questions
- Which receive-buffer values should a shred receiver start with?
- For a dedicated Linux host, keep its active default receive memory, set the ordinary request ceiling to 134,217,728 bytes, and request 4,194,304 bytes through SO_RCVBUF. Record the returned effective amount, then validate it with controlled pauses, UdpRcvbufErrors, per-socket drops, queue residence, and catch-up time.
- Should busy polling be enabled globally?
- Leave both global busy-poll sysctls at zero initially. On a dedicated receiver, test SO_BUSY_POLL of 50 microseconds at the target socket. A useful result lowers tail latency without socket loss or a saturated ingest core. Global settings affect unrelated sockets and can waste CPU continuously.
- Can sysctl tuning eliminate UDP loss?
- No. Sysctls can move or resize specific kernel queues, but they cannot repair NIC loss, an undersized driver ring, bad affinity, sustained application under-capacity, a restrictive firewall, or upstream absence. Locate the first rising drop counter, change the control for that stage, and verify packet age as well as loss.