Poor Game Server Performance

Ok, So ive gotten a Counter-Strike: Source server setup (SRCDS). For those familiar with CS:S I have two game types: ZombieMod and GunGame…

ZombieMod: 3-4 players against 20-30 Bots (CPU Players)

GunGame: 3-4 Players against 3-4 other players (No Bots)

Now when playing I seem to get a lot of lag. With ZombieMod it can go 5-10 seconds before I get "lagged" back about 2 seconds, sometimes it can get shot back 5-6 seconds, this happens for everyone on the server. When playing GunGame I get similair and lesser lag.

This to some extent infers that the problem is CPU usage. When running ZombieMod by CPU usage goes to around 60-70%, but when running GunGame I still get 30-40%.

I have had to replace my /proc/cpuinfo with one that the server can understand (See http://www.linode.com/forums/viewtopic.php?t=2491). Prehaps my /proc/cpuinfo is leading SRCDS to believe that the machine is better then It actually is, and that is causing problems. I am using the following /proc/cpuinfo:

processor       : 0
vendor_id       : GenuineIntel
cpu family      : 15
model           : 2
model name      : Intel(R) Xeon(TM) CPU 2.40GHz
stepping        : 7
cpu MHz         : 2393.024
cache size      : 512 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 1
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 2
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid
bogomips        : 4789.92

Ok, now that i've typed a wall of text, does anyone have an suggestions as to how to fix this problem? It half-seems like my servers connection gets cut off for a second every few seconds, but I know this is not the case.

Thanks,

Smark

9 Replies

I've never set up a Counter Strike server, but in the time I've had my Linode, I've seen similar issues where things work fine for a while, then suddenly become slow or unresponsive. This has happened with several applications, and usually turns out to be one of two things:

* IO Limiter: If Counter Strike is IO bound or causes your Linode to start swapping, the IO limiter will kill you. Running 30-40 bots may be the culprit, but that doesn't explain the issue when it's just humans playing.

****/dev/random:**** If Counter Strike is pulling random data from /dev/random–and I can think of several reasons it would--entropy can run out in a hurry. Linux usually generates entropy (in part) from keyboard & mouse interrupts. Being a headless system, Linodes run out quickly.</list> 

I'm not sure if this helps, but it's something to investigate.

–James

Thanks for the response.

Is there any monitoring tools that I should look into that could help me to isolate the issue? IE, what the server is drawing on. Maybe find what the server needs the "most of" and try to figure out a way to make that more efficient.

Thanks,

Smark

For the IO limiter, you can look at /proc/iostatus–iotokens is the important number. For /dev/random you can look at /proc/sys/kernel/random/entropy_avail. If you want to monitor them, start the following in an ssh session, then start playing the game and see if one of them goes down rapidly.

while true; do cat /proc/sys/kernel/random/entropy_avail /proc/io_status; sleep 1; done

You can stop that with ctrl-c. If you don't want to watch it in a terminal, it should be fairly easy to set up job to graph the numbers with rrdtool.

If you don't see the numbers changing, then you might need to look somewhere else.

If you can't figure it out, try asking in the IRC channel. That's usually a good place to get help.

–James

That's interesting. My io_tokens=-28 is negative all the time and once in a while goes up to maybe 300/400. Does that point to a serious problem? Thanks

Ok so I tried what irgeek suggested, played for about 10 minutes, here are the graphs (I'll make some better ones tonight when Im at home)…

/proc/sys/kernel/random/entropy_avail

~~![](<URL url=)http://spectralcoding.com/files/picture … e/rand.png">http://spectralcoding.com/files/pictures/linode/rand.png" />

/proc/iostatus - iorate

~~![](<URL url=)http://spectralcoding.com/files/picture … tokens.png">http://spectralcoding.com/files/pictures/linode/iotokens.png" />

/proc/iostatus - iotokens

~~![](<URL url=)http://spectralcoding.com/files/picture … okens2.png">http://spectralcoding.com/files/pictures/linode/iotokens2.png" />

The Y-axis shows iorate, iotokens, and entropy_avail

The X-axis shows time (each number represents about half a second)

The spike in the io_status graph is going to be the loading of the map, which was roughly 40-50mb

Basically is what I did, was I had each output to a different file, here was the sequence of events:

1. Start Logging

2. 30 seconds later start the server

3. 1 min after that I connected which triggered the bots to join the server

4. Play for about 3-4 minutes

5. I then reduced the bot count to 10 from 32

6. Played for another 3-4 minutes.

7. Reduced the bot count to 5

8. Played for another 3-4 minutes

9. Disconnected from the server

10. 10-30 seconds later I shut down the server

Im not sure how to interpret the iotokens graph, but the entropy graph seems to drop, then go higher every time i reduce the CPU player count…

Thanks for all the help so far,

Smark

PS. The actual data can be found here:

http://spectralcoding.com/files/io_tokens.txt

http://spectralcoding.com/files/entropy.txt~~

jcr,

Yes, that's a problem. That means your I/O is running at a drastically reduced rate. Most likely, this is a result of not having enough physical RAM. Once a Linode starts swap thrashing, the I/O tokens will disappear fast.

You'll want to reduce your memory footprint (or upgrade your Linode).

Smark, my apologies if it looks like i'm hijacking your thread with my own configuration but since we are both dealing with io_status, I believe, it's ok.

Xan, thanks. I am going to look into updating my linode or maybe having two separate linodes.

Right after my post, I disabled a couple of routines that were doing a lot of IO (mainly updating fields in an sqlite database every minute) and now, it looks like this:

iocount=1877652 iorate=0 iotokens=2000000 tokenrefill=512 token_max=2000000. that's a dramatic change.

What would be a good source of information to understand iocount, iorates, why they would decrease or the stock of io_tokens would replenish?

to answer my own question: http://www.theshore.net/~caker/uml/patc … ter.README">http://www.theshore.net/~caker/uml/patches/token-limiter.README

Smark, I'm not quite sure how to interpret the entropy values since I've never really had to track/investigate it myself. My server, which is doing nothing but serving webpages and passing mail, for the most part, shows 182 entropy_avail right now. So I'm guessing what you have is reasonably healthy.

The IO looks pretty good in my opinion. It looks like when you first start the mission, there's a heavy IO load and the tokens drop rapidly. From then on, the amount of tokens gradually climbs, so you're using less than you're regaining. At least with just the one player and some bots, anyway. Sharp spikes down towards zero would be a sign of trouble here, IMHO.

I'm wondering if the other nodes on the host machine are simply having activity spikes that are interfering with the "real time" nature of the service you're running.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct