I'm paying for the Linux only two core package right now
I have two css servers running, one is private and one is a public server. I was wondering if there is a way to assign a server to each core.
I'm using a server start script my friend gave me, here is what it looks like:
#!/bin/sh
#Server Start Script by The1Speck
#Vars
SRVRNICK="servername"
CMDLINE="-game cstrike -console -debug -usercon -tickrate 100 -maxplayers 15 -maxplayers_override 15 +map bhop_arcane_v1 -ip xx.xxx.xxx -port 27016 -insecure"
if screen -ls | grep -q $SRVRNICK; then
screen -S $SRVRNICK -X quit
screen -dmS $SRVRNICK ./srcds_run $CMDLINE
echo $SRVRNICK has been restarted.
else
screen -dmS $SRVRNICK ./srcds_run $CMDLINE
echo $SRVRNICK has been started.
fi
I use this script on both servers to start and stop etc, I don't have much linux knowledge and the server has been experiencing random lag spikes which I cant track at all because they are so random, and I wanted to know if there was a command I can add to this script to assign the process to a core since I have two cores
[Debian 8 Server] Question about Counter-Strike:Source server assigning cores
-
- New to forums
- Posts: 1
- https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
- Joined: Fri Jun 24, 2016 5:54 pm
- Vanderburg
- Former staff
- Posts: 1253
- Joined: Sat Nov 13, 2010 7:27 am
- Location: Dallas, TX
Re: [Debian 8 Server] Question about Counter-Strike:Source server assigning cores
You could do this with taskset, though, generally, the OS does a pretty good job with this one its own.
For instance, if you had a process 1234 that you wanted only to run on the first core, you'd use:
and you could put process 4321 on core 2:
(Remember that the counting starts at 0, so core 1 is #0 and core 2 is #1)
-p lets you use the process ID of the program.
-a applies the affinity of all threads related to that process
-c lets you list the cores being used.
If you wanted to put process 9876 on cores 3 AND 4, you'd do the following:
Again, I don't really recommend setting this manually.
For instance, if you had a process 1234 that you wanted only to run on the first core, you'd use:
Code: Select all
taskset -pac 0 1234
Code: Select all
taskset -pac 1 4321
-p lets you use the process ID of the program.
-a applies the affinity of all threads related to that process
-c lets you list the cores being used.
If you wanted to put process 9876 on cores 3 AND 4, you'd do the following:
Code: Select all
taskset -pac 2,3 9876