I am an experienced Lua programmer and have just made a gamemode for a server of mine from scratch, it is rather big in size, but all of the code is optimized and there’s no abundant network or resource usage occurring, yet the server is experiencing some extraordinary lags. As far as I know, these lags have nothing to do with the actual server it is running on.
I suspect most of you know the console command ‘net_graph’, perhaps some even use ‘net_graph 4’. I have opened this up on the server with my gamemode and took a screenshot of it with about 10 players online.
The lag doesn’t seem to be present all the time, but it occasionally kicks in. What you see if this in the net_graph is that the two variables at the bottom, sv and var (I have NO idea what those are, but I presume sv is the server tickrate. Var I don’t know but I would like to know - Couldn’t find it anywhere), suddenly start spiking up. sv will heavily fluctuate between 90 and 110 during a spike (lasts ~0.5 seconds) and the var can increase from 2-4 normally to anything between 10 an 40 msec, where 40 msec completely dislocates players.
I can’t put a finger of what is causing this, and I have completely searched through my gamemode for possible causes of this issue, with no result.
Also, when a player joins the server, other connected players have a similar spike, but the sv or var do not change. (A spike like this can be seen in the visual chart, the most right spike)
Since these problems occur even with no further addons but the gamemode installed and a tickrate enabled (Tickrate_Enabler v0.4, the only one there is?), I would like to blame the tickrate addon, even though I can’t be sure. I am not sending massive amounts of data on player connect either. There are no timers that are constantly running in the gamemode.
I hope someone can think with me and hopefully point out what could be the golden tip to a lag-less server.