Jarate Chop!

TF2 Server or Network Lag?

A common question from many players is what causes lag, rubber banding or stuttering. This article deals only with server & network issues and is for those players who can confidently say "I know it's not my PC" and "what's wrong with the server?"

From a server/network POV there's two main issues that can cause gameplay issues.

Both can be diagnosed from a user's POV via net_graph 4. Type this into your console and you'll get a time series graph something like this:

net_graph 4 showing server CPU lag

Note the sv: number above. It reports the fps of the server as of the latest update received by the client. Source servers are locked at 66 ticks so the perfect server should consistently show sv: 66.7. The "var" shows the standard deviation of the server's frametime (where server fps = 1.0 / frametime) over the last 50 frames recorded by the server. (I stole this from the Valve wiki referenced below). Lower variance is better.

If you see the sv: number fall below 66.7 fps, particularly to values < 50 you can be certain that the issue is server side. In the example above the server CPU is underpowered as the FPS has dipped to 31.6. Keep in mind that CPU load changes constantly - the server works its hardest when there is a lot of action, e.g. a craptonne of spam, or 22 MvM bots suddenly spawning.

For server operators - you can also check the sv: fps via the console 'stats' command. FPS dips are likely due to underpowered CPU but it can also be caused by other issues, for example running out of memory and hitting swap.

If the sv: figure is consistently 66.7 fps and you still notice stuttering, lag or rubber banding then there's probably something wrong with the network between you and the server.

NOTE: I am assuming you are running the default TF2 rate (30000), cl_updaterate (30), cl_cmdrate (30) and cl_interp (0.1) settings; you may want to set the rate higher to something like 80000. The rate setting only defines a maximum data rate. Setting it to a higher value allows the server to send you more bytes if it needs to (for example if there is lots going on in a fight) but the server will never send you more than it needs so there is no harm in having a high rate setting.

Network issues will manifest as gaps in the vertical bars as indicated here:

net_graph 4 showing possible network lag

Each of those coloured vertical bars represents an update received from the server. Gaps indicate missing updates. The tricky part here is that missing updates could be caused by several factors - the most obvious being network issues between you and the server resulting in packet loss, but it could also be due to the server not being able to keep up CPU wise – this is why I began by pointing out the sv: figure earlier. You should always look for sv: issues first, and only if the server side looks fine then suspect a network issue.

In this case what looks like a network issue is actually a CPU issue - I run this particular server and the CPU is underpowered. The snapshot shows missing updates but if you could go back in time you would have seen the sv: number dip down to 15 fps during those periods. This screenie is from an MvM Wave666 game and the server struggled whenever 20 bots suddenly spawned, and during the last waves when there's 20 demomen all spamming pills.

TF2 Network Graph
Source Multiplayer Networking