Server Operators Unite! Tips, Tweaks and Experiences Inside

Horseless HeadmanHorseless Headman Join Date: 2011-01-07 Member: 76594Members
edited January 2011 in NS2 General Discussion
<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.

Comments

  • devicenulldevicenull Join Date: 2003-04-30 Member: 15967Members, NS2 Playtester, Squad Five Blue
    <!--quoteo(post=1823395:date=Jan 11 2011, 06:06 PM:name=Horseless Headman)--><div class='quotetop'>QUOTE (Horseless Headman @ Jan 11 2011, 06:06 PM) <a href="index.php?act=findpost&pid=1823395"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I'm currently running a vanilla config with the following server.exe parameters: -name "FakkelBrigade's Selection" -map ns2_rockdown -limit 12 -lan false -save true<!--QuoteEnd--></div><!--QuoteEEnd-->
    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.
  • Alpha.Alpha. Join Date: 2011-01-04 Member: 76186Members
    edited January 2011
    I wonder if someone managed to connect to server's web interface?
  • Horseless HeadmanHorseless Headman Join Date: 2011-01-07 Member: 76594Members
    edited January 2011
    Haven't gotten around to the web interface yet. Will test later. I'm planning on using <a href="http://forum.specialattack.net/viewtopic.php?f=94&t=7639" target="_blank">NS2Monitor</a> to restart the server when memory usage exceeds 2GB. I'll update my initial post if I'm content with it. Just updated to b161, I hear it's still fairly laggy, I'll report back later.

    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?
  • endarendar Join Date: 2010-07-27 Member: 73256Members, Squad Five Blue
    edited January 2011
    I've noticed that in build 161 the cpu usage patterns have changed. In 160 and previous, it was always on core 0(1) (the left most in taskmanager), but now I have about 40% on core 5, and a more random 10% on core 0. Anyone elsee see similar?
    <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.
  • Alpha.Alpha. Join Date: 2011-01-04 Member: 76186Members
    edited January 2011
    Hello


    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.
  • playerplayer Join Date: 2010-09-12 Member: 73982Members
    <!--quoteo(post=1823628:date=Jan 12 2011, 08:29 PM:name=Alpha.)--><div class='quotetop'>QUOTE (Alpha. @ Jan 12 2011, 08:29 PM) <a href="index.php?act=findpost&pid=1823628"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I'm still trying to find a way how to use web administration interface - without any results for now.<!--QuoteEnd--></div><!--QuoteEEnd-->
    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.
  • Alpha.Alpha. Join Date: 2011-01-04 Member: 76186Members
    edited January 2011
    wine Server.exe -webadduser alpha -webpass 1234567890 -webdir "c:/" -webdomain 188.40.XXX.XXX:8080
    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?
  • playerplayer Join Date: 2010-09-12 Member: 73982Members
    You don't add the port in the '-webdomain'-switch, delete and recreate the .htpasswd-file and drop the port this time. I'm using Firefox.

    You left one of the IPs uncensored by the way.
  • Horseless HeadmanHorseless Headman Join Date: 2011-01-07 Member: 76594Members
    <!--quoteo(post=1823628:date=Jan 12 2011, 08:29 PM:name=Alpha.)--><div class='quotetop'>QUOTE (Alpha. @ Jan 12 2011, 08:29 PM) <a href="index.php?act=findpost&pid=1823628"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->To make log use '>'. Example: 'wine server.exe > log.txt' - will create log.txt in where server.exe is located.<!--QuoteEnd--></div><!--QuoteEEnd-->

    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.
  • Alpha.Alpha. Join Date: 2011-01-04 Member: 76186Members
    <!--quoteo(post=1823663:date=Jan 12 2011, 10:11 PM:name=player)--><div class='quotetop'>QUOTE (player @ Jan 12 2011, 10:11 PM) <a href="index.php?act=findpost&pid=1823663"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->You don't add the port in the '-webdomain'-switch, delete and recreate the .htpasswd-file and drop the port this time. I'm using Firefox.

    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:/"
  • endarendar Join Date: 2010-07-27 Member: 73256Members, Squad Five Blue
    <!--quoteo(post=1823540:date=Jan 12 2011, 08:49 PM:name=endar)--><div class='quotetop'>QUOTE (endar @ Jan 12 2011, 08:49 PM) <a href="index.php?act=findpost&pid=1823540"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->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.<!--QuoteEnd--></div><!--QuoteEEnd-->

    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).
  • Horseless HeadmanHorseless Headman Join Date: 2011-01-07 Member: 76594Members
    I'm quite interested in any monitoring tools Windows administrators use... I'd like to see some graphs on tickrate etc among the usuals. Anyone?

    Also, I forgot to tell Windows Update to just Download rather than Download + Install.. damn Microsoft restarted my server today. Ouch. Silly me.
Sign In or Register to comment.