Having Problems With Garry's Mod Server - Lag?

I am hosting a Garry’s Mod TTT Server on Linux (SteamCMD). Throughout playing player(s) walking will be choppy and going up/down ladders is really choppy. You can also walk through props.

My server is using 30% CPU usage and 50% RAM. Everyone has 40-120 ping. The servers upspeed is about 200 mb/s.

I am guessing it is something I am doing wrong starting the server?

I am only running pointshop addon plus some custom player models.

Thanks in advanced, Fetz

try sitting the tickrate to 33

What CPU does the server have?

SRCDS isn’t multi-threaded which means that the server will only utilize two threads, one for networking and one for the server and its physics, so it doesn’t matter if your server has a hex-core processor with low clockrate. A dual-core with higher clock-rate would benefit the server alot more.

You can check if the server is using 100% of a thread at that point if you install the htop linux package:

apt-get install htop
-- Or this one, depending on what distro of linux you use.
yum install htop

Now run the newly installed package by issuing a command: htop
You will see a few bars looking like this, depending on how many cores/threads you have and if Hyper-Threading is enabled:


Those are your CPU’s cores/threads. If one of them are utilizing nearly 100% when your server is under load, then you know your CPU can’t handle the amount of players and/or physics your server is having. That’s when you put this into the startup params of your shell script: -tickrate 33.

Setting the tickrate to lower is very useful, the default tickrate is 66, setting it to 33 won’t make any difference on Garry’s Mod, but it has heavy impacts on games that relies on precision such as the Counter-Strike and Team-Fortress series.

Hope this helps a bit! :slight_smile:

[editline]20th January 2014[/editline]

Also, a tip:

The Intel Xeon E3-1290v2 (3.7Ghz, 4.1Ghz turbo boost), Intel Xeon E3-1240v2 (3.4Ghz, 3.8Ghz turbo boost) and Intel Xeon E3-1230v2 (3.3Ghz, 3.7Ghz turbo boost) are very good CPU’s for handling a GMod server! :wink:

Because the issue involves an increase in ping.
It may have something to do with the network connection.

I got htop and monitered the CPU… none of the cores went over 60%. Same for the RAM :confused:

I don’t understand why it still lags.

Turn on net_graph 4 in your own console and watch the blue line at the very bottom of the graph when connected to your server. If red spikes appears there, the server lags. If not, your computer is the one that lags.

Red Line(S) appear at combat a lot.

Is this ping lag or FPS lag?

No, you’re looking at the client graph. You want to look for red like in this picture:

(The highligted area, can you see the red spikes there? If you do on your own server, THEN you know that the server is lagging. Otherwise, it’s all client-side and has nothing to do with the server).

Hey, I’m having the same problem, I am having the same red bars at the bottom of the net graph. I have installed and run htop but it’s not showing any cpu overload. Eveyone’s ping on the server is less than 100, well mostly. See images below:

What’s the specs on that CPU? Ghz wise.

Lower tickrate to 33 with -tickrate 33 startup param.

I am unsure, I am hosting from a VPS, the only information I am given is that there are 3 cores dedicated to the VPS. I have submitted a request for the information though. I will apply the changes suggested and report back :slight_smile:

EDIT: The problem seems to persists when I set the parameter to 33.

Post your server.cfg, maybe you have something wrong there. If not try getting rid of addons.

The only addons I have are PointShop AssMod and mapvote. This is my server.cfg:

hostname         	"Samsta is awesome!"
rcon_password    	""
sv_password      	""
sv_region        	255
sv_lan           	0
sv_logbans       	1
sv_logecho       	1
sv_logfile       	1
sv_log_onefile   	0
sv_noclipspeed   	5
sv_noclipaccelerate	5
logging          	on
//Sandbox Settings
sbox_allownpcs  	0
sbox_godmode     	0
sbox_plpldamage  	0
sbox_playergod   	0
sbox_noclip      	1
sbox_maxprops    	250
sbox_maxragdolls 	5
sbox_maxnpcs     	5
sbox_maxballoons 	25
sbox_maxeffects  	25
sbox_maxdynamite 	5
sbox_maxlamps    	10
sbox_maxthrusters	250
sbox_maxwheels   	50
sbox_maxhoverballs	 50
sbox_maxvehicles 	8
sbox_maxbuttons  	50
sbox_maxsents    	20
sbox_maxemitters 	5
sbox_maxspawners 	3
sbox_maxturrets  	10
//Server Settings
net_maxfilesize  	30
sv_minrate       	0 
sv_maxrate       	2500
decalfrequency   	10
sv_maxupdaterate 	66
sv_minupdaterate 	10
//Execute ban files
exec banned_ip.cfg
exec banned_user.cfg
sv_downloadurl "http://x.xxx.xxx.xxx/fastdl/"
sv_allowdownload "1"
sv_allowupload "1"
net_maxfilesize 600

Check this for Server Settings part: https://support.steampowered.com/kb_article.php?ref=5386-HMJI-5162

The processor is 3GHz

So what? You are having internet lag ( “in: 6000” on the net_graph - that is not normal afaik ).

I have brought up the issue with the host, just to be sure, is 4GB of ram dedicated to the one application sufficient (plus a few background tasks)?

Yes, SRCDS hardly never uses more than 600MB. And that CPU should be able to handle a fair amount of players without issue, so it’s problably as Robotboy says; it’s client-side - your own network being the issue.

All of the players on the server are experiencing the same lag spikes at the same time. All of the players are not in the same location, to me it seems more than just my connection.

Make sure you put these convars for your server:

sv_minrate       	0 
sv_maxrate       	2500
sv_maxupdaterate 	66
sv_minupdaterate 	10

To have the values recommended by Valve ( from the link I posted )