Skip to content

Lesson 9 of 9 · 26m

Operating Netcode in Production: Measure, Degrade, Contain

Instrument tick health, packet quality, correction rates, and abuse signals so production incidents become observable engineering instead of community folklore.

Most netcode incidents are first reported as vibes: "hits are broken," "everyone is teleporting," "the servers are bad." Sometimes the community is right. Sometimes a routing change, a bad build, one overloaded machine, or a new cheat wave is hiding inside the vibe. Operations work is how you turn vibes into timelines.

Measure the clocks that define truth

At minimum, track server tick duration, missed ticks, input queue depth, snapshot serialization time, send rate, packet loss, jitter, correction magnitude, validation rejects, and rewind window usage. Percentiles matter because averages hide the worst frames.

netcode_tick_seconds{quantile="0.5"}      0.0041
netcode_tick_seconds{quantile="0.95"}     0.0102
netcode_tick_seconds{quantile="0.99"}     0.0197
netcode_late_ticks_total                  311
netcode_input_queue_depth                 4.8
netcode_reject_total{reason="cooldown"}   128

Pair metrics with build version, map, region, player count, and server instance. A regression that appears only on one map or one cloud instance type is not a global mystery once labeled properly.

Reproduce network weather in the lab

You cannot design forgiveness without controlled bad weather. Linux network namespaces and tc netem are crude but useful:

sudo tc qdisc add dev eth0 root netem delay 90ms 20ms distribution normal loss 1.5%
# run client/server tests, then remove the impairment
sudo tc qdisc del dev eth0 root

Test stable latency, jitter, burst loss, reordering, asymmetric paths, and recovery after total outage. A lab test that only uses localhost tells you the code can run, not that players can play.

Capture packet evidence without drowning

tshark can answer whether loss or duplication exists outside the application:

tshark -i any -f 'udp port 27015' -w match-traffic.pcapng

Do not capture every production packet forever. Game traffic is high-volume and may include voice or identifying metadata. Prefer sampled captures, short incident windows, flow statistics, and application-level sequence-gap metrics. Store only what the investigation requires.

Design degradation before outage day

When a server falls behind, decide what degrades first. Common levers are snapshot frequency for distant entities, cosmetic replication, spectator quality, physics detail, and nonessential events. Never silently degrade hit validation or inventory invariants to save CPU.

first   reduce distant/cosmetic replication frequency
second  reduce nonessential physics and visual state fidelity
third   cap new joins or migrate matches
never   skip authoritatively validated consequences

Degradation should be explicit in telemetry. If hit registration changed because the server was overloaded, support and engineering should be able to see that.

Cheat containment is incident response

A cheat wave is handled like a security incident: preserve evidence, identify affected versions and regions, separate detection confidence tiers, ship mitigations, and communicate carefully. Banning immediately on weak signals can false-positive honest players; waiting forever destroys trust. Replay data, validation telemetry, and controlled test accounts are your containment tools.

Post-incident review should change the model

After a bad networking incident, ask whether the system failed at measurement, validation, authority, budget, or rollout. "Players had lag" is not a root cause. A useful root cause sounds like: snapshot serialization exceeded the tick budget when 24 players clustered in one zone, causing late input application and increased correction distance.

Field notes

  • Player reports are signal, not proof. Correlate them with tick health, routing, build rollout, and regional packet metrics.
  • Do not expose raw per-player network telemetry publicly if it reveals abuse investigations or sensitive infrastructure detail.
  • Load tests with bots must reproduce input cadence and entity clustering; idle clients do not stress the same systems.
  • The cheapest mitigation is often better relevance filtering: send less, less often, to fewer clients.

Was this lesson helpful?

Sign in to rate