SRCDS Steam group


Linux lib for HL-based servers
#1
Can anyone make a linux library that loads in hlds_run or srcds_run via LD_PRELOAD and do the following :

Quote:-automatic bind hlds/srcds server to random cores (from cpu0 to cpu15)
-has a rule that will not bind more than 6 servers on one core

Can it be done ? Of cuorse, it would be great to be even more "inteligent", like knowing that it's wrong tu bind a hlds and srcds server to the same cpu core , or even more , knowing not to bind high slots servers on same core ...

I am willing to pay via paypal for something like this.
Thank you.

Reply
#2
Why don't you script it in bash? It's easier than writing the logic in C code.

http://leaf.dragonflybsd.org/~gary

“The two most common elements in the universe are hydrogen and stupidity.”








Reply
#3
Because the servers are started with GameCP .. so it's easier to load the lib directly into hlds_run / srcds_run .
And second reason is that i don't know how to script Shy
Reply
#4
this is done much easier with a script. you could just change the srcds_run / hlds_run script to do this. if you want to try it on your own, I give you a hint: taskset or cset is the command to bind a process to a cpu.
http://www.fpsmeter.org
http://wiki.fragaholics.de/index.php/EN:Linux_Optimization_Guide (Linux Kernel HOWTO!)
Do not ask technical questions via PM!
Reply
#5
I know about taskset but the lib would have to be more complicated :

1.Auto detect numbers of cpu cores
2.Auto detect number of hlds/srcds servers on HDD
3.Auto bind maximum 6 hlds/srcds servers to one core
4.Don't bind hlds and srcds to the same cpu
5.Don't bind more than 3 hlds servers on one cpu that have > 22 slots
6.Don't bind more than 3 srcds servers on one cpu that have > 22 slots

It's hard to do such a lib that's why i said that i'm willing to pay.
Reply
#6
(02-10-2011, 08:29 PM)saintjimmygd Wrote:  I know about taskset but the lib would have to be more complicated :
but this can be done in a shell script much easier...

Quote:1.Auto detect numbers of cpu cores
Code:
NCPU=`cat /proc/cpuinfo | grep processor | wc -l`

Quote:2.Auto detect number of hlds/srcds servers on HDD
depends on server layout. you can detect the number of running processes with:
Code:
NSRCDS=`ps ax | grep srcds_i686 | wc -l`
NHLDS=`ps ax | grep hlds_i686 | wc -l`
NSRV=$(( NSRCDS + NHLDS ))

Quote:3.Auto bind maximum 6 hlds/srcds servers to one core
6 server per cpu? that's mad. nevertheless I would design the script to put a new server on the cpu with the lowest number of server currently running on. that is of course not so easy to do, but it doesn't get easier in a ld_preload lib. I would use:
Code:
cat /proc/<PID>/status | grep Cpus_allowed:
to find out the CPU a server process is running on.

Quote:4.Don't bind hlds and srcds to the same cpu
don't run hlds and srcds on the same machine. binding them to different cpus does not make it better. only physical separation on different machines helps.

Quote:5.Don't bind more than 3 hlds servers on one cpu that have > 22 slots
6.Don't bind more than 3 srcds servers on one cpu that have > 22 slots
finding out the number of slots can be done by analysing the command line quite easy in a shell script.

Quote:It's hard to do such a lib that's why i said that i'm willing to pay.
it's still easier to do it as a shell script. ld_preload is simply the wrong tool for this. it's like putting nails into a wall with a screw driver...

(I did not test all of the code above...)
http://www.fpsmeter.org
http://wiki.fragaholics.de/index.php/EN:Linux_Optimization_Guide (Linux Kernel HOWTO!)
Do not ask technical questions via PM!
Reply
#7
**COUGH**

Useless use of 'cat' spotted.
Cool
Reply
#8
LOL

+1111111 laws.
http://leaf.dragonflybsd.org/~gary

“The two most common elements in the universe are hydrogen and stupidity.”








Reply
#9
**COUGH**

trolls spotted.
http://www.fpsmeter.org
http://wiki.fragaholics.de/index.php/EN:Linux_Optimization_Guide (Linux Kernel HOWTO!)
Do not ask technical questions via PM!
Reply
#10
(02-27-2011, 05:15 PM)HiDef-Laws Wrote:  **COUGH**

Useless use of 'cat' spotted.
Cool

Code:
NCPU=`cat /proc/cpuinfo | grep processor | wc -l`
NCPU=`grep processor /proc/cpuinfo | wc -l`
NCPU=`grep -c processor /proc/cpuinfo`

Quote:finding out the number of slots can be done by analysing the command line quite easy in a shell script.
Example:
Code:
#!/bin/bash

maxplayers() {
   maxplayers=0
   while [ $# -gt 0 ]; do
        case "$1" in
        "-maxplayers")
            maxplayers=$2
            break
            ;;
        esac
    shift
    done
    }

maxplayers $*

echo "-maxplayers = $maxplayers"
#do something with $maxplayers

./srcds_run $*
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)