Skip to content

Instantly share code, notes, and snippets.

@so0k
Last active March 16, 2023 09:42
Show Gist options
  • Save so0k/7446931 to your computer and use it in GitHub Desktop.
Save so0k/7446931 to your computer and use it in GitHub Desktop.
srcds boost
#!/bin/sh
### srcds_boost.sh, r3 - http://forums.srcds.com/viewtopic/17440
# add isolcpus to grub & disable irqbalance service
# ref: https://access.redhat.com/site/solutions/15482
### ensure sda IO scheduler is CFQ if available
### don't set ionice if not, test with (assuming srcds is on sda)
# grep cfq /sys/block/sda/queue/scheduler
### expected output:
# noop anticipatory deadline [cfq]
# - put SRCDS server on CPU2
# - FIFO scheduling, high prio
# - IO scheduling to realtime, high prio (make sure CFQ is available before running this script
pids=`ps -u csgoserver -o pid,cmd | grep srcds_linux | grep -v grep | grep -Eo '^ ?([0-9]+)'`
#schedtool -a 2 -n -10 $pids
taskset -pc 2 $pids
chrt -p -f 30 $pids
ionice -c 1 -n 2 -t -p $pids
##before script:
# taskset -p $pids
## output:
# pid 1886's current affinity mask: f
# chrt -p $pids
## output:
# pid 1886's current scheduling policy: SCHED_OTHER
# pid 1886's current scheduling priority: 0
# ionice -p $pids
## output:
# none: prio 0
##after script:
# taskset -p $pids
## output:
# pid 1886's current affinity list: 0-3
# pid 1886's new affinity list: 2
# chrt -p $pids
## output:
# pid 1886's current scheduling policy: SCHED_FIFO
# pid 1886's current scheduling priority: 30
# ionice -p $pids
## output:
# realtime: prio 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment