Setting affinity on multi cpu servers is a must. Although it's easy to do, when running a failsafe script to restart a crashed server, I have not found a command to automatically set the affinity for the process. Does any have any ideas? The servers will be running Windows Server 2003.
well I don't knw of any command to do this, but I think a program like firedaemon will do it. I don't have any links for it, I haven't ever used the program myself. Serverchecker needs to have that option (if it doesn't already, haven't looked at it in awhile, lol)
ermac Wrote:Setting affinity on multi cpu servers is a must
Where did you read this? Really not necessary to set affinity higher for srcds.
higher? higher would be for the priority... affinity is needed for running multiple servers on a dual core, or dual cpu server for the simple fact srcds doesn't utilize multiple cpu's. You will gain a lot of performance by setting affinity, and splitting the load evenly between cpu's. (this is what major gsp's, and I'm pretty sure even Alfred from valve have said.)
03-27-2006, 12:32 PM (This post was last modified: 03-27-2006, 12:38 PM by Hollanda.)
Ok:
(1) You don't need to set priority higher than normal
(2) Deviding processes between cores or CPU's is also not necessary. DO THIS ONLY IT YOU RUN THE SERVER ON THE SAME BOX AS YOU ARE PLAYING ON!!
So on a "real" server you don't need to set affinity on CPU 0 or 1. This will only take away the advantage from having two cores or CPU's, which means that if one core or CPU is overloaded windows will automaticaly set 1 or more processes to the other core or CPU.
(3) If you are running the server on the same box you are playing on recommended is to set affinity of srcds.exe to CPU "1"
03-27-2006, 03:06 PM (This post was last modified: 03-27-2006, 03:07 PM by skeletor.)
alright, so your telling me that Alfred (one of valves developers for srcds) doesn't know what hes talking about, alright.
priority only needs to be set higher if you play on the same computer (not in all cases, but if you lack computer power you may need to).
Affinity, needs to be set on any dual core, or dual cpu system. I'm done argueing, its pointless, and this isn't the place for debate.
When hosting on a dual core or dual cpu server, hosted on windows you would not make full use of the potential. Window automatically sets a process to a CPU that has capacity. This means windows makes optimal use from the installerd cpu('s).
Hollanda Wrote:When hosting on a dual core or dual cpu server, hosted on windows you would not make full use of the potential. Window automatically sets a process to a CPU that has capacity. This means windows makes optimal use from the installerd cpu('s).
This would be correct if Windows was able to automatically move processes from one CPU to the next while they were running, but it can't.
So, using your own logic, if a server is freshly booted and all of the hosted servers need to be started, Windows will place each processes on CPU1 because all of the SRCDS processes will be idle, hence no activity. This will remain the same with little or no people playing on the servers. Now with 10 servers running on CPU1, what happens when they are all full? lag/crash/etc.
Now to combat this, you clearly need to define the processor affinity of the server when it is started. You can manually change the affinity after it starts, but that is not ideal if this is all done with scripts.
This brings us to why I am here. I am also looking for an easy way to set affinity. I can compile a small C app to do it, but I'm hoping something exists out there already. If the OP has found anything yet, please let us know! Thanks.
The instructions are on the page, but you also run imagecfg /? to display the available switches to use.
This will actually set the processor affinity for a process in a specific location, not just based on process name. So if you have c:\hlds1\scrds.exe and c:\hlds2\srcds.exe, etc., you can specifiy the affintiy for each seperate instance, and once you do it, it stays like to for ever, so you do not have to change you batch scripts or whatever you use to launch srcds!
I tested this out just now with notepad.exe and also on a batch file (.cmd) and noticed this will not work on a batch file. You must run imagecfg on the the executable itself.
I hope this helps you other server admins out there with multi CPU/Core servers. If you have luck with this, or questions on it, please keep them in this thread so we can all come back and learn from it.
Without seeing what the indvidual threads are doing, you can't see much. Task manager is pretty useless for threads. It's hard to tell since you have a fairly idle server, but what you are probably seeing is the threads spread accross the CPU's, but with srcds only the first thread uses the majority of user time. If you launched all of these at once, and got lucky, the main thread was placed on different processors as they might have been busy while starting, causing Windows to assign the new srcds instances to different processors.
You should be able to test this by changing the affinity srcds instances to CPU0 or CPU1 when the servers are more fully loaded with players so you can see the effect. If you manually start the instances, and know which of them are on CPU0 and CPU1, then start more instances and set the affinity of those to CPU0 and CPU1, you will notice that the original instances on CPU0 and CPU1 will not be moved to CPU2 and CPU3. They will contine to run on CPU0 and CPU1 because that is where the main thread was originally assigned. You can manually set the affinity of them to 2 and 3, but the Windows scheduler will not do move those threads on it's own, thus causing CPU's 2 and 3 to remain mostly idle while 1 and 2 are overloaded.
If you don't mind, could you let me know how the two 275's are for a dedicated srcds server? I am looking to build the same here, and was wondering how many servers/slots you have been able to run on each core. I assume you are running 32 bit windows since you only have 4GB of RAM... do you hit a memory limit with that server before the CPU limit? Have you tried running srcds on 64 bit 2003 server? I was thinking of trying that with 8GB or more of RAM to support maybe 12 - 16 servers on the system. What do you think?