Server Operators Unite! Tips, Tweaks and Experiences Inside
Horseless Headman
Join Date: 2011-01-07 Member: 76594Members
<div class="IPBDescription">optimize the NS2 experience on your server</div>You! Yes YOU!
I know you're out there, server operators (and other techs). It's time to pull together and share our knowledge and resources. We all know the issues, some of us know how to circumvent them, others how to minimize the damage.... but we need to share.
A multiplayer FPS/RTS is all fun and games as long as there are quality servers out there. So it stands to reason we try our best and consolidate our experience for the benefit of us all. Right?
I'm currently running a vanilla config with the following server.exe parameters: -name "FakkelBrigade's Selection" -map ns2_rockdown -limit 10 -lan false -save true
Although I'm afraid I don't have much to offer yet (just got my HLDS NS2 b160 up and running on Windows Server 2008 R2 on an HP ML110 G5 with Intel Xeon 3065 @ 2.33GHz, 6GB RAM, not a particularly high-performance disk, no RAID) I'm running a Performance Monitor as we speak to gather some data. So far I'm seeing 15-20% CPU and 431MB RAM usage on an empty server running ns_rockdown.
As far as generic advice goes, I suggest running server.exe with High processor priority especially if the server isn't dedicated to NS2. I'm running on 2 cores but I might dedicate one later, depending on my findings.
If you've found a convar or XML setting that tweaks your server's performance, or have a particular OS configuration to optimize your server, please share.
I know you're out there, server operators (and other techs). It's time to pull together and share our knowledge and resources. We all know the issues, some of us know how to circumvent them, others how to minimize the damage.... but we need to share.
A multiplayer FPS/RTS is all fun and games as long as there are quality servers out there. So it stands to reason we try our best and consolidate our experience for the benefit of us all. Right?
I'm currently running a vanilla config with the following server.exe parameters: -name "FakkelBrigade's Selection" -map ns2_rockdown -limit 10 -lan false -save true
Although I'm afraid I don't have much to offer yet (just got my HLDS NS2 b160 up and running on Windows Server 2008 R2 on an HP ML110 G5 with Intel Xeon 3065 @ 2.33GHz, 6GB RAM, not a particularly high-performance disk, no RAID) I'm running a Performance Monitor as we speak to gather some data. So far I'm seeing 15-20% CPU and 431MB RAM usage on an empty server running ns_rockdown.
As far as generic advice goes, I suggest running server.exe with High processor priority especially if the server isn't dedicated to NS2. I'm running on 2 cores but I might dedicate one later, depending on my findings.
If you've found a convar or XML setting that tweaks your server's performance, or have a particular OS configuration to optimize your server, please share.
Comments
12 players is probably a bi much. 10 players is maxing a core in my x5420 server.
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->Although I'm afraid I don't have much to offer yet (just got my HLDS NS2 b160 up and running on Windows Server 2008 R2 on an HP ML110 G5 with Intel Xeon 3065 @ 2.33GHz, 6GB RAM, not a particularly high-performance disk, no RAID) I'm running a Performance Monitor as we speak to gather some data. So far I'm seeing 15-20% CPU and 431MB RAM usage on an empty server running ns_rockdown.<!--QuoteEnd--></div><!--QuoteEEnd-->
15-20% translates to about 100% of a core, which is what I'm seeing. 431MB matches the memory usage of my server as well. Be aware that NS2 (server) has had a fairly nasty memory leak on and off since the early alpha days. You should expect crashes, and run some type of script to auto restart
<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec-->As far as generic advice goes, I suggest running server.exe with High processor priority especially if the server isn't dedicated to NS2. I'm running on 2 cores but I might dedicate one later, depending on my findings.<!--QuoteEnd--></div><!--QuoteEEnd-->
That won't really help unless your server is terribly loaded. NS2 is single threaded, so multiple cores won't help.
Edit: I've also reduced my slots to 10, as advised by devicenull. Has anyone figured out how to have their server auto-update yet?
<a href="http://img715.imageshack.us/img715/2843/taskmand.png" target="_blank">http://img715.imageshack.us/img715/2843/taskmand.png</a>
Also, does anyone have experience or tales of running 2 servers on the 1 machine now? I'm interested in doing that. I am not talking about the same IP, I have two, just more curious on how they behave.
EDIT:
<a href="http://img339.imageshack.us/img339/8296/taskmanf.png" target="_blank">http://img339.imageshack.us/img339/8296/taskmanf.png</a>
After some more time had passed, it's changed more to look like this.
I dont have a screen of the 160 taskmanagers, but basically its 90% of core 0 all the time, the other 5 are empty.
I'd like to add my trick - how to ban players easily. It's pretty simple and its based on banning specific ip on your machine. It's linux solution, but concept can be used on windows too ofc.
1. Use screen to run Your NS2 server using putty. 'apt-get install screen', then You can read about it <a href="http://www.bangmoney.org/presentations/screen.html" target="_blank">here</a>
2. If you run 'server.exe' with some parameters AND '-save true' flag - parameters You used will be saved to '/AppData/Natural Selection 2/server.xml'
So next time You can run server.exe without any parameters - they will be taken from server.xml
3. Now about logging. If you want to ban someone - You need to know his/her IP. Easiest way to find it is to log it. Then, You look for specific nick in log, IP of this player is usually above it (sometimes few lines above). To make log use '>'. Example: 'wine server.exe > log.txt' - will create log.txt in where server.exe is located. Example content of log.txt:
<!--sizeo:2--><span style="font-size:10pt;line-height:100%"><!--/sizeo--><i>Debian-50-lenny-64-minimal:/home/NS2# cat log.txt
Disabled saving of configuration file overrides.
Build 161
Starting Natural Selection 2
Starting server
Couldn't open file 'models/marine/robotics_factory/robotics_factory.model'
PrecacheModel(models/marine/robotics_factory/robotics_factory.model) file doesn't exist.
Couldn't open file 'models/marine/prototype_module/prototype_module.model'
PrecacheModel(models/marine/prototype_module/prototype_module.model) file doesn't exist.
Couldn't open file 'models/alien/shift/shift.model'
PrecacheModel(models/alien/shift/shift.model) file doesn't exist.
Couldn't open file 'models/alien/shade/shade.model'
PrecacheModel(models/alien/shade/shade.model) file doesn't exist.
Couldn't open file 'models/alien/onos/onos.model'
PrecacheModel(models/alien/onos/onos.model) file doesn't exist.
Couldn't open file 'models/alien/onos/onos_view.model'
PrecacheModel(models/alien/onos/onos_view.model) file doesn't exist.
Couldn't open file 'models/alien/cocoon/cocoon.model'
PrecacheModel(models/alien/cocoon/cocoon.model) file doesn't exist.
Couldn't open file 'models/marine/heavy/heavy.model'
PrecacheModel(models/marine/heavy/heavy.model) file doesn't exist.
Couldn't open file 'models/marine/minigun/minigun.model'
PrecacheModel(models/marine/minigun/minigun.model) file doesn't exist.
Couldn't open file 'models/marine/minigun/minigun_view.model'
PrecacheModel(models/marine/minigun/minigun_view.model) file doesn't exist.
Couldn't open file 'models/marine/jetpack/jetpack.model'
PrecacheModel(models/marine/jetpack/jetpack.model) file doesn't exist.
Loading 'maps/ns2_rockdown.level'
TechPoint:OnMapPostLoad(): Couldn't find any egg spawn entities near "Marine Start" tech point, hives built here won't create eggs. - Server
TechPoint:OnMapPostLoad(): Couldn't find any egg spawn entities near "Marine Start" tech point, hives built here won't create eggs.
Local server active.
<!--coloro:#0000FF--><span style="color:#0000FF"><!--/coloro-->Client connected (109.91.XXX.XXX).
Dolce & Lebowski connected.<!--colorc--></span><!--/colorc-->
Client disconnected (109.91.XXX.XXX) Timeout <b>--------------------------------> I banned user</b>
<!--coloro:#008000--><span style="color:#008000"><!--/coloro-->Client connected (82.139.XXX.XXX).
#156.Alpha connected.<!--colorc--></span><!--/colorc-->
Client connected (109.91.XXX.XXX). <b>-----------------------------------> then unbanned</b>
Dolce & Lebowski connected.
Chat All - Dolce & Lebowski: "working again"
Chat All - Dolce & Lebowski: "strange"</i>
4. Linux commands to ban/unban IP<!--sizec--></span><!--/sizec--> address:
iptables -A INPUT -s 0.0.0.0 -j DROP //block ip
iptables -D INPUT -s 0.0.0.0 -j DROP //remove block
Of course You have to change 0.0.0.0 to actual IP You found in log
5. Behavior.
After I banned him - user reported connection problems and timeout. Then my server disappeared from his server list. Server was still running ofc. After unbanning - everything was normal, client connected again. I have to add that this way of banning will prevent user from connecting Your <!--coloro:#0000FF--><span style="color:#0000FF"><!--/coloro-->machine<!--colorc--></span><!--/colorc--> not only NS2 server running on it.
I hope someone will benefit from this solution, but still it's sad that there are players that made me look for solution how to ban them :/
I'm still trying to find a way how to use web administration interface - without any results for now.
Thank You Dolce & Lebowski for being my tester.
Are you having problems getting passed the authentication-stage? Ensure that the string you passed with the -webdomain switch during creation of the .htpasswd-file matches what you enter in the browser EXACTLY. Suppose you do "-webdomain localhost", then you MUST access it via localhost:8080, 127.0.0.1:8080 will not function.
then:
wine Server.exe -webadmin true -webdomain 188.40.XXX.XXX:8080 -webdir "c:/"
It was what I've done at the very beggining. No effect. Server responds but I can't log in.
EDIT: player - what browser are You using?
You left one of the IPs uncensored by the way.
This is true. ">" Would overwrite the existing log file upon restarting your server. ">>" Would append the existing file. You should be weary the logs don't get too big in size though. I'm using >> "ServerLog-%date%.log" at the moment which will append the log if you restart on the same date it was created but will create a new one otherwise. Mind the "" because %date% outputs as <i>day date</i> so there's a space.
Trying to figure out a more elegant way of managing log files but there are only so many things you can do in a batch file.
You left one of the IPs uncensored by the way.<!--QuoteEnd--></div><!--QuoteEEnd-->
Thank You for both advices, both were useful. Right commands to make web admin interface work:
wine Server.exe -webadduser alpha -webpass 1234567890 -webdir "c:/" -webdomain 188.40.XXX.XXX
wine Server.exe -webadmin true -webdomain 188.40.XXX.XXX -webdir "c:/"
OK easier than I thought, lets see how it performs. Don't need a second IP now as the listen port is server port+1 now. Using 27015 (6) and 27017(8).
Also, I forgot to tell Windows Update to just Download rather than Download + Install.. damn Microsoft restarted my server today. Ouch. Silly me.