Raised This Month: $51 Target: $400
 12% 

L4D2 Dedicated Server Network Tweaks


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sempiro
Member
Join Date: Apr 2014
Old 03-06-2019 , 08:19   L4D2 Dedicated Server Network Tweaks
Reply With Quote #1

Hello,

Some of my friends experiencing occasional lags on our L4D2 server, hence I need a little bit of help with network settings. It would be much appreciated if you could point out possible network issues in my Server.cfg settings and/or provide any recommendations on how to improve the performance, considering provided specs, running conditions and Server.cfg commands below.


System and network specs: i7 (4,2 Ghz, 4 cores) , 16 ram, 300 Mbps (300 Mbps UP/ 33 Mbps DOWN)

Running conditions: I run only one instance of the server at all times. The server has 8 active players + 2 spectators, which gives 10 players/slots in total.

Server.cfg network related commands as follow:

Code:
sm_cvar fps_max 300
sv_alternateticks 0
sv_forcepreload 1
sm_cvar sv_minrate 100000                     
sm_cvar sv_maxrate 100000                      
sm_cvar sv_minupdaterate 100                   
sm_cvar sv_maxupdaterate 100                   
sm_cvar sv_mincmdrate 100                     
sm_cvar sv_maxcmdrate 100                      
sm_cvar sv_client_min_interp_ratio -1         
sm_cvar sv_client_max_interp_ratio -1          
sm_cvar nb_update_frequency 0.015             
sm_cvar net_splitpacket_maxrate 100000        
sm_cvar fps_max 0   
                          
sm_cvar mp_autoteambalance 0                  
sm_cvar sv_unlag_fixstuck 1                   
sm_cvar chestbump_patch_enabled 1             
sm_cvar z_brawl_chance 0                      
sm_cvar sv_maxunlag 1                         
sm_cvar sv_client_predict 1                    
sm_cvar sv_client_cmdrate_difference 0        
sm_cvar sv_max_queries_sec 6                   
sm_cvar sv_max_queries_global 120              
sm_cvar sv_player_stuck_tolerance 5           
sm_cvar sv_stats 0                            
sm_cvar sv_clockcorrection_msecs 15
Thank you very much in advance for any help provided!
Sempiro is offline
PatriotGames
AlliedModders Donor
Join Date: Feb 2012
Location: root@irs:/# rm -rf /
Old 03-15-2019 , 15:13   Re: L4D2 Dedicated Server Network Tweaks
Reply With Quote #2

Lag can be caused by many factors including plugins (most likely), network latency (your ISP), server resource constraints, etc. Without any information about these variables, I can only offer some general suggestions. Most importantly, if you don't know for certain the effect of a cvar, especially network cvars, don't add it to your server.cfg. Tuning network performance can be challenging enough without adding additional unknown variables.

Regarding your network settings, unless you are running a tick-rate enabler extension, your sv_min and sv_max settings are still locked at 30K. Having said that, the network settings you have are for a 100-tick l4d2 server, so if you are running tick-rate enabler with -tickrate 100 in your launch line, it will put a significantly higher load on your server, which can be amplified the number and type of plugins you're running, both of which can cause lag spikes.

Think about doing some testing on your server with netgraph_4 on your client and pay attention to the server's performance under various events (mob spawns and panic events in particular).

Here are some general network settings for default 30-tick & 100-tick l4d2 servers. There are different opinions about these settings, especially among the competitive l4d community, so do some homework before doing a copy-pasta:
Code:
//--> Server Rates 30-tick
sm_cvar sv_minrate 30000                         // Should never change this.
sm_cvar sv_maxrate 30000                        // Set Value to: Tickrate * 1000
sm_cvar sv_mincmdrate 30                        	// Should never change this.
sm_cvar sv_maxcmdrate 30                         // Set Value to Tickrate.
sm_cvar sv_minupdaterate 30                     // Should never change this.
sm_cvar sv_maxupdaterate 30                    // Set Value to Tickrate.
sm_cvar nb_update_frequency 0.033           	// Default 0.1 - Lowest possible value before noticing stuttering common (0.024)
sm_cvar net_splitpacket_maxrate 15000		// Set Value to: (Tickrate / 2) * 1000
sm_cvar sv_client_min_interp_ratio 0
sm_cvar sv_client_max_interp_ratio 2
Code:
//--> Server Rates 100-tick
sm_cvar fps_max 0					// Forces Server to perform the best it can
sm_cvar sv_minrate 30000                         // Should never change this.
sm_cvar sv_maxrate 100000                         // Set Value to: Tickrate * 1000
sm_cvar sv_mincmdrate 30                        	// Should never change this.
sm_cvar sv_maxcmdrate 100                         // Set Value to Tickrate.
sm_cvar sv_minupdaterate 30                     // Should never change this.
sm_cvar sv_maxupdaterate 100                    // Set Value to Tickrate.
sm_cvar nb_update_frequency 0.033           	// Default 0.1 - Lowest possible value before noticing stuttering common (0.024)
sm_cvar net_splitpacket_maxrate 50000			// Set Value to: (Tickrate / 2) * 1000
sm_cvar sv_client_min_interp_ratio 0
sm_cvar sv_client_max_interp_ratio 2

Here are my comments on your settings:
Code:
// =====  General Settings  ===== //
sm_cvar sv_stats 0 // good!

sm_cvar mp_autoteambalance 0 // fine, although if you're attempting to prevent unwanted team switching in Versus, there are plugins that prevent/control this, which I've posted here

sm_cvar z_brawl_chance 0 // not a network setting. Common Infected won't randomly fight each other.

sm_cvar chestbump_patch_enabled 1 // for Chestbump extension - not a network setting


// =====  Network Settings  ===== //
sm_cvar fps_max 300 // listed twice with 2 diff values
sm_cvar fps_max 0 // same as above, so cancels the other setting because this one comes last. This value uncaps fps_max, and if combined with a 100-tick rate, can put a lot of strain on your cpu.  You get the benefits of tickrate unlock with an fps_max as low as 200, which puts less strain on your processor.  Experiment with this setting.

sm_cvar sv_minrate 100000 // unless you're running a tickrate enabler extension, these are locked at 30K                  
sm_cvar sv_maxrate 100000
                   
sm_cvar sv_minupdaterate 100                   
sm_cvar sv_maxupdaterate 100
              
sm_cvar sv_mincmdrate 100                     
sm_cvar sv_maxcmdrate 100
                    
sm_cvar sv_client_min_interp_ratio -1 // this allows any value for these client-side settings.  I think it's better to set upper and lower cap values per above examples.      
sm_cvar sv_client_max_interp_ratio -1
        
sm_cvar nb_update_frequency 0.015 // per comments above, experiment with this to find the optimal value just above that which causes the common infected to stutter, if that matters to you.  For my servers, .024 was the lowest value before stuttering.         
sm_cvar net_splitpacket_maxrate 100000

                          
// I would leave these settings out (default values) until you get a better baseline on network performance with the other settings.  Even then, these are probably more for testing unless you know for certain how they will affect network performance. 

sv_alternateticks 0
sv_forcepreload 1               
sm_cvar sv_unlag_fixstuck 1                        
sm_cvar sv_maxunlag 1                         
sm_cvar sv_client_predict 1                    
sm_cvar sv_client_cmdrate_difference 0        
sm_cvar sv_max_queries_sec 6                   
sm_cvar sv_max_queries_global 120              
sm_cvar sv_player_stuck_tolerance 5              
sm_cvar sv_clockcorrection_msecs 15
Good luck!
PG

Last edited by PatriotGames; 03-15-2019 at 19:32.
PatriotGames is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 03-16-2019 , 04:34   Re: L4D2 Dedicated Server Network Tweaks
Reply With Quote #3

Code:
sm_cvar net_splitpacket_maxrate 30000	// Set Value to: Tickrate * 1000
sm_cvar net_maxcleartime 0.00001 //bypasses the rate limits
That is fine it is the safest if you have the upload for this


To get the max upload at your tickrate you can disable the splitpacket queuing
with this it forces a fragment each frame with each update.( This is the best network throughput i'v found)

Code:
WINDOWS ONLY
sm_cvar net_maxcleartime 0.00001 //bypasses the rate limits
sm_cvar net_queued_packet_thread 0
sm_cvar net_splitrate 1 //don't set above 1
net_splitpacket_maxrate  // this cvar does not matter while using this above
The downside to this if you have server stutters that feel worse why i never recommend this if you run alot of plugins.



I recommend not touching(nb_update_frequency) this because common infected collision is calculated more often and can choke the flow of common infected around doorways and small areas
can make a 30zombie horde trickle though at higher tickrates like 128 this is more of an issue the more often you update them.
Left 4 dead was designed with limiting updates of common's you could fix this with editing the NAV mesh?
Code:
sm_cvar nb_update_frequency 0.1


This cvar is kinda special when using tickrate enabler you can put it higher than your tickrate but there are alot of variables
Code:
Tickrate enabler required.
sm_cvar net_splitpacket_maxrate 192000
sm_cvar net_splitrate 2 
sm_cvar net_maxcleartime 0.00001
sm_cvar net_queued_packet_thread 1
an example below

Running 128tick server @30fps (sm_cvar fps_max 30)
you can have the value of 192000 only until you reach packetsizes of 12000 bytes per update you start having problems.


Here is a gif i made when i asked spirit 12 about this a few months ago if tricking clients to thinking the tickrate was higher could allow more data over the network it was just an idea but i don't really know how this works.
I was just sending as much data as i could with e.g.Usermessages entities ect.

30Tickrate default l4d the choke is huge. // has fragments around 10~ but snapshots take a huge hit
https://gfycat.com/AdoredPertinentKronosaurus


capped @30fps
250tickrate with net_splitpacket_maxrate 250000 // this creates far more fragments 3x mostly and the game is playable
https://gfycat.com/SickAmusedHound


To round this up i'm unsure why having higher server tickrate clients can accept more packet fragments persecond, if you tried sending 30fragments while keeps snapshot updates around 20 clients would get overflowed @tickrate of 30, higher server tickrate NO PROBLEM

Ayy this turned into a longer post than i thought, i'm just sharing my research and experience enjoy.
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D

Last edited by Lux; 03-16-2019 at 22:54.
Lux is offline
Mr. Man
Veteran Member
Join Date: Mar 2011
Location: Huh?
Old 03-17-2019 , 15:04   Re: L4D2 Dedicated Server Network Tweaks
Reply With Quote #4

PatriotGames, Lux:

Appreciate the effort in writing such a detailed post about network optimization - managed to solve some of the choke/hiccup issues I am currently facing.
Mr. Man is offline
diceboy
Member
Join Date: Jun 2012
Old 03-19-2019 , 07:33   Re: L4D2 Dedicated Server Network Tweaks
Reply With Quote #5

Why You use two fps_max cvars ? 0 and 300 ?
diceboy is offline
PatriotGames
AlliedModders Donor
Join Date: Feb 2012
Location: root@irs:/# rm -rf /
Old 03-23-2019 , 16:26   Re: L4D2 Dedicated Server Network Tweaks
Reply With Quote #6

Quote:
Originally Posted by Mr. Man View Post
PatriotGames, Lux:

Appreciate the effort in writing such a detailed post about network optimization - managed to solve some of the choke/hiccup issues I am currently facing.
Excellent! Glad it helped!

Quote:
Originally Posted by diceboy View Post
Why You use two fps_max cvars ? 0 and 300 ?
That is a mistake in his server.cfg. There should be only one value for any given cvar. If multiple values are accidentally included only the last value will be applied.
PG

Last edited by PatriotGames; 03-23-2019 at 16:30.
PatriotGames is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:45.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode