Cpu Usage
auxiliary
Join Date: 2003-08-07 Member: 19160Members
i'm being told that 85% cpu usage is normal? can someone please clarify this... hopefully a dev that knows how the linux server runs. i would really like to get the cpu usage on my machine down (just having to upgrade the cpu is not what i want to hear) so that i can run this server. otherwise i'll have to remove NS i think because 85-93% cpu usage just isn't right. my other post is in the main server support forum but the only reply i got was to upgrade, so anyone that could help i would really appreciate it.
link to my first post: <a href='http://www.unknownworlds.com/forums/index.php?act=ST&f=8&t=41924' target='_blank'>http://www.unknownworlds.com/forums/in...=ST&f=8&t=41924</a>
copy of top running on my machine:
64 processes: 60 sleeping, 4 running, 0 zombie, 0 stopped
CPU states: 86.9% user, 2.6% system, 0.0% nice, 10.5% idle
Mem: 1552752K total, 1498416K used, 54336K free, 26328K buffers
Swap: 297192K total, 448K used, 296744K free, 1176104K cached
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
3328 hlds 20 0 84028 82M 5772 R <b>86.8</b> 5.4 666:20 hlds
link to my first post: <a href='http://www.unknownworlds.com/forums/index.php?act=ST&f=8&t=41924' target='_blank'>http://www.unknownworlds.com/forums/in...=ST&f=8&t=41924</a>
copy of top running on my machine:
64 processes: 60 sleeping, 4 running, 0 zombie, 0 stopped
CPU states: 86.9% user, 2.6% system, 0.0% nice, 10.5% idle
Mem: 1552752K total, 1498416K used, 54336K free, 26328K buffers
Swap: 297192K total, 448K used, 296744K free, 1176104K cached
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
3328 hlds 20 0 84028 82M 5772 R <b>86.8</b> 5.4 666:20 hlds
Comments
If you are running HLDS_L 3.1.1.0 and NS alone with no MetaMod, adminmod, AMX or Clanmod you can expect about 60% usage, of course it also matters what map you are running too. hera and bast are much better CPU then thier 1.04 counterparts but they still take more cycles then the other maps. Try running lost and see how your server runs, that maps seems to be very efficient.
My specs are AMD 1900+, 512MB ram, RedHat 7.3 running 3.1.1.0, Metamod and AdminMod and about a dozen of so plugins between adminmod and metamod.
Here's my server stats, CPU usage and such. I run a 12 player server
<a href='http://www.vadakill.com/rrdtool' target='_blank'>http://www.vadakill.com/rrdtool</a>
I'm also running Admin Mod and Metamod.
<i>Pebbs</i>
PS: OS is Red Hat 8.0 with latest SMP Kernel
--------------------------------------------------------------------------------------------------------------
12:45am up 30 days, 13:20, 1 user, load average: 0.94, 2.02, 3.25
89 processes: 88 sleeping, 1 running, 0 zombie, 0 stopped
CPU states: 67.5% user, 4.6% system, 0.0% nice, 27.7% idle
Mem: 1031012K av, 800840K used, 230172K free, 0K shrd, 119264K buff
Swap: 1044216K av, 12408K used, 1031808K free 444156K cached
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
14680 root 13 -12 69268 67M 5844 S < 50.7 6.7 154:21 hlds
14447 root 5 -10 81240 79M 5076 S < 20.1 7.8 102:53 hlds
--------------------------------------------------------------------------------------------------------------
PID # 14680 - NS Server, 14 of 18 (with 2 reserves) players at the time of comparison.
PID # 14447 - TFC Server, 14 of 18 players at the time of comparison.
Your box would take up about 80% resources. 2GHZ box takes about 60% resources when it hits 14-18 players. 60% of an 2ghz box is 1.2 ghz. Your box might even be a little faster than mine.. <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->
You could run a 20 player server because what I have found was after 14 players it kind of doesn't matter how many more players join the CPU doesnt go up by much. You could run about two CS servers if you'd like but whats two more CS servers to the community? Theres already an overwhelming amount of CS servers out there. I'd try NS until HL2 comes out and stuff <!--emo&:)--><img src='http://www.unknownworlds.com/forums/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif'><!--endemo-->
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->top - 06:29:41 up 134 days, 12:23, 1 user, load average: 0.31, 0.30, 0.15
Tasks: 83 total, 5 running, 78 sleeping, 0 stopped, 0 zombie
Cpu(s): 32.9% user, 2.7% system, 0.0% nice, 64.4% idle
Mem: 1033472k total, 986988k used, 46484k free, 230460k buffers
Swap: 530136k total, 41596k used, 488540k free, 460704k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ Command
26099 gameserv 18 0 99.0m 92m 5712 R 31.9 9.2 583:23.19 hlds<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
This is actually higher than normal. Usually is at or below 25% CPU usage, commonly in the teens. There are also two counter-strike servers up with people on them, but they never use above 1% CPU.
Here the is 'stat' from the console:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->hostname: Texas [HK] Palace NS 2.0 1Gbit
version : 46/3.1.1.0 2163 insecure
tcp/ip : 64.5.61.160:27015
map : ns_tanith at: 0 x, 0 y, 0 z
players : 20 active (22 max)
# name userid uniqueid frag time ping loss adr
1 "Xp|izit- 2301 997162 1 08:42 88 0 68.161.92.202:27005
2 "$" 2276 2434057 10 1 :23:58 52 0 12.245.129.250:27005
3 "Asakura- 2290 169746 5 44:02 54 0 68.96.215.176:27005
4 "CptBlood 2278 542806 4 1 :06:30 136 0 216.161.132.233:25995
5 "NSPlayer 2296 1318576 3 27:49 235 0 203.125.72.241:27005
6 "Bloodlin 2280 942290 11 57:19 36 0 24.174.99.61:18406
7 "101sT.Ni 2308 182448 0 00:29 247 0 61.93.144.214:27005
8 ".:[ Lerk 2282 4009912 8 57:00 72 0 63.228.82.125:1025
9 "hackslas 2297 1377045 7 15:40 76 0 65.32.77.83:27005
10 "Vash" 2288 2687605 13 47:37 49 0 66.57.249.165:63502
11 "Elf" 2241 1126456 4 3 :39:13 39 0 66.69.25.12:43773
12 "pure.i - 2294 3621410 11 40:33 81 0 216.78.199.25:27005
13 "Rodviper 2266 71645 6 2 :01:35 78 0 68.153.100.115:13886
14 "Samanosk 2300 1845994 3 10:22 63 0 68.102.223.165:27005
15 "Arlong" 2302 779799 0 05:29 439 3 218.252.33.115:27005
16 "[Goo-Loo 2303 3206428 0 05:27 268 0 219.77.80.5:27005
17 "Rage" 2304 617024 2 05:26 256 0 204.96.222.252:27005
18 "DoC HoLi 2272 4075925 4 1 :50:05 80 0 68.81.151.173:27005
20 "Joker-9" 2240 3388950 11 3 :44:36 64 0 66.91.235.188:27005
21 "hiba.iDG 2306 596419 1 03:49 64 0 66.27.170.42:43622
20 users<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
Someone logged off between the top and stat cut'n'paste. As you can see there are some thirty millisecond pings in there. I personally ping 20-30 on my server, and I have seen a ping as low as 13 in game. We run metamod with the configuration stored in a MySQL4 database... Lots of other **** run on the server too.
For comparison, my system's hardware and software is as follows:
Asus P4G8X Deluxe (7205 chipset - "Granite Bay")
Pentium4 2.66Ghz
1GB dual-channel CL2 ECC PC2100 RAM (2 x Kingston KVR266X72C2/512)
Onboard BCM5702 Gigabit ASIC (using broadcom's driver, offloads most network/IP calculations to integated RISC processors)
Gentoo Linux:
cat /proc/version -> Linux version 2.4.20-gentoo-r2 (root@palace.clanhk.org) (gcc version 3.2.2) #1 Thu Mar 27 18:34:29 CST 2003
All packages compiled with CFLAGS="-mcpu=pentium4 -O2 -pipe -msse -mmmx -mfpmath=sse"
We used to run HLDS 3.1.1.1 for DoD, but after NS2.0 came out we got rid of 3.1.1.1 for 3.1.1.0. That improve performance by about 40% for us. Your CPU usage seems uncharacteristically high. Make sure you're running HLDS 3.1.1.0 If you don't have the low-latency pacth, preemptible kernel patch, and Igno's O(1) scheduler patched into your kernel consider adding those.
The latest HLDS revision (3.1.1.1) is HORRRIBLE for CPU usage. 3.1.1.0 is so much better. You should consider regressing. 3.1.1.1 has serious problems.
14680 root 13 -12 69268 67M 5844 S < 50.7 6.7 154:21 hlds
14447 root 5 -10 81240 79M 5076 S < 20.1 7.8 102:53 hlds
(...) <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
You are cracy to run a gameserver as root.
Maybe some guys installed some rootkits already. <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif'><!--endemo-->
Dont be cracy and read that: <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif'><!--endemo-->
<a href='http://void.at/advisories.html' target='_blank'>http://void.at/advisories.html</a>
<a href='http://www.securityfocus.com/bid/8300/info/' target='_blank'>http://www.securityfocus.com/bid/8300/info/</a>
<a href='http://www.securityfocus.com/bid/8301/info/' target='_blank'>http://www.securityfocus.com/bid/8301/info/</a>
Read that:
<a href='http://www.securityfocus.com/bid/8300/info/' target='_blank'>http://www.securityfocus.com/bid/8300/info/</a>
<a href='http://www.securityfocus.com/bid/8301/info/' target='_blank'>http://www.securityfocus.com/bid/8301/info/</a>
<!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
nice, 94% cpu usage.. <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif'><!--endemo-->
Read that:
<a href='http://www.securityfocus.com/bid/8300/info/' target='_blank'>http://www.securityfocus.com/bid/8300/info/</a>
<a href='http://www.securityfocus.com/bid/8301/info/' target='_blank'>http://www.securityfocus.com/bid/8301/info/</a> <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
<a href='http://www.unknownworlds.com/forums/index.php?act=ST&f=8&t=40291' target='_blank'>The thread</a> shows how to downgrade with the security patch to fix the DDOS attack exploit that saubloed mentioned. There is a new boffix binary to download and patches for the old HLDS to make it more secure
Ok. But this just fix the DoS problem.
Check this exploit if you have time:
<a href='http://www.securityfocus.com/bid/8300/exploit/' target='_blank'>http://www.securityfocus.com/bid/8300/exploit/</a>
I run a P4 2.0 Ghz box w/ 1GB RAM and RH 8.
I run a 21 person NS server, and a 14 person private NS server on the same box.
Current stats:
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
28323 admin 14 0 105M 100M 6040 R 38.7 9.9 705:07 hlds
hostname: Twilight Eclipse Uber NS 2.0 - CD opt
version : 46/3.1.1.0 2163 insecure
tcp/ip : 207.44.184.62:27015
map : ns_caged at: 0 x, 0 y, 0 z
players : 19 active (21 max)
# name userid uniqueid frag time ping loss adr
# 2 "[No C-D]Roumba" 1104 51884 0 38:02 71 1 207.70.155.119:20265
# 3 "jay" 1108 511026 0 32:53 102 0 12.206.74.108:17024
# 4 "[No C-D]Gods-Angel" 1088 4105691 0 1:02:07 98 0 12.231.175.235:22652
# 5 "FranktheTank" 1125 2541420 1 14:33 100 0 68.19.230.143:50428
# 6 "[No C-D]Renobe" 1109 4087899 0 32:50 66 0 68.54.255.187:2394
# 7 "[No C-D]naMsdrawkcaB" 1089 2338042 1 1:01:17 72 0 67.80.174.251:43620
# 8 "Monkey Striker" 1084 3670074 0 1:06:46 149 0 24.85.4.151:27005
# 9 "[No C-D]Complete Newbie" 1137 2365180 0 03:32 41 0 12.237.240.151:19449
#10 "Na!L.Bunny" 1075 3846987 0 1:23:07 83 0 206.74.30.234:43621
#11 "eMatrix" 1138 3162539 4 03:30 50 0 68.0.96.41:27005
#12 "|TE|I Am The Force*" 1098 4082913 0 47:57 98 0 63.196.255.39:27005
#13 "|TE|Litus-AACR*" 1123 200152 1 14:43 125 0 24.81.144.38:27005
#14 "|TE|Javelin*" 1134 3011657 0 05:59 132 0 24.80.42.139:65164
#15 "MangoMan305" 1036 592118 1 2:01:44 115 0 67.35.28.139:27005
#16 "General_Havok~]V[S" 1139 2003400 0 03:14 80 0 24.52.98.71:27006
#17 "[No C-D]mugetsu305" 1048 4063773 0 1:49:07 127 0 67.34.53.27:50759
#18 "|TE|Jimbo-AACR" 1118 359815 1 17:22 94 0 68.3.235.142:43620
#19 "|TE|astv" 1103 867827 1 38:21 94 0 24.206.140.55:19243
#21 "|TE|Rage*" 1096 670851 1 50:17 222 0 66.94.128.218:27005
19 users
Private server is empty so its taking no CPU.
I have seen the server get up to 85% CPU on maps like bast and tanith after hour long games. This is only a problem when the private server is being used also, because when it is full it tends to take 20-30% CPU and pings start spiking when both servers are trying to hog some CPU
Read that:
<a href='http://www.securityfocus.com/bid/8300/info/' target='_blank'>http://www.securityfocus.com/bid/8300/info/</a>
<a href='http://www.securityfocus.com/bid/8301/info/' target='_blank'>http://www.securityfocus.com/bid/8301/info/</a><!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
So? I run 3.1.1.0c:
<!--c1--></span><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td><b>CODE</b> </td></tr><tr><td id='CODE'><!--ec1-->D:\Documents and Settings\Ryan.AERYN>C:\Games\download\hlbof-server\hlbof-server
.exe
Half-Life server buffer overflow & freeze (0.1)
by Auriemma Luigi
e-mail: aluigi@pivx.com
web: http://www.pivx.com/luigi/
Versions affected: 1.1.1.0, 4.1.1.1a and 3.1.1.1c1
Usage: C:\Games\download\hlbof-server\hlbof-server.exe <bug_number> <host> [port
(27015)]
bug_number:
1 Parameter buffer-overflow: prints a string into the console of the dedicated
server and crash the game server (possible remote code execution).
The target dedicated server must be the Windows version 1.1.1.0, if not you
will not see my message but the return address will be likewise overwritten
(SWDS.DLL must have the MD5 187a300a636d01a67918b706a5ef85a4 if you want to
see the message)
2 Value buffer-overflow: freezes ANY Half-life server (infinite loop)
D:\Documents and Settings\Ryan.AERYN>C:\Games\download\hlbof-server\hlbof-server
.exe 1 ns.clanhk.org
Half-Life server buffer overflow & freeze (0.1)
by Auriemma Luigi
e-mail: aluigi@pivx.com
web: http://www.pivx.com/luigi/
Versions affected: 1.1.1.0, 4.1.1.1a and 3.1.1.1c1
--------------------------------------------------
protocol: 46
address: 64.5.61.160:27015
players: 21
proxytarget: 0
lan: 0
max: 22
gamedir: ns
description: Natural Selection
hostname: Texas [HK] Palace NS 2.0 1Gbit
map: ns_veil
type: d
password: 0
os: l
secure: 0
mod: 1
modversion: 2
svonly: 0
cldll: 0
Challenge: 3058003862
Connect: Invalid userinfo in connect command
Result: The server doesn't seems to be vulnerable
D:\Documents and Settings\Ryan.AERYN>C:\Games\download\hlbof-server\hlbof-server
.exe 2 ns.clanhk.org
Half-Life server buffer overflow & freeze (0.1)
by Auriemma Luigi
e-mail: aluigi@pivx.com
web: http://www.pivx.com/luigi/
Versions affected: 1.1.1.0, 4.1.1.1a and 3.1.1.1c1
--------------------------------------------------
protocol: 46
address: 64.5.61.160:27015
players: 21
proxytarget: 0
lan: 0
max: 22
gamedir: ns
description: Natural Selection
hostname: Texas [HK] Palace NS 2.0 1Gbit
map: ns_veil
type: d
password: 0
os: l
secure: 0
mod: 1
modversion: 2
svonly: 0
cldll: 0
Challenge: 3058003862
Connect: Invalid userinfo in connect command
Result: The server doesn't seems to be vulnerable<!--c2--></td></tr></table><span class='postcolor'><!--ec2-->
As you can see, my server isn't vunerable. I also compiled the other exploit and tested it against my server and it failed to have any effect what so ever. You can use 3.1.1.0 without fear of security if you get the newest patch and maintain your system properly.
14680 root 13 -12 69268 67M 5844 S < 50.7 6.7 154:21 hlds
14447 root 5 -10 81240 79M 5076 S < 20.1 7.8 102:53 hlds
(...) <!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
You are cracy to run a gameserver as root.
Maybe some guys installed some rootkits already. <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif'><!--endemo-->
Dont be cracy and read that: <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif'><!--endemo-->
<a href='http://void.at/advisories.html' target='_blank'>http://void.at/advisories.html</a>
<a href='http://www.securityfocus.com/bid/8300/info/' target='_blank'>http://www.securityfocus.com/bid/8300/info/</a>
<a href='http://www.securityfocus.com/bid/8301/info/' target='_blank'>http://www.securityfocus.com/bid/8301/info/</a> <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
Thanks ill switch it over to a different user.. The directory is actually from a regular user account but I wasn't sure how to start a process as a different user in /etc/rc.local (startup file). If you know how that would be great but for now ill start process up manually. Sometimes when I need to update my servers I kill the processes then do /etc/rc.local to start them back up. Its a Game Server only box. Thanks again for the heads up.
<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
nice, 94% cpu usage.. <!--emo&:D--><img src='http://www.unknownworlds.com/forums/html/emoticons/biggrin.gif' border='0' style='vertical-align:middle' alt='biggrin.gif'><!--endemo--> <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
Load average is the average number of processes in the running queue, IOW, processes whose state is "RUNNING", IOW, processes between which the CPU time is shared (i.e.processes that are idle or waiting for I/O don't affect it)
You are cracy to run a gameserver as root.
Maybe some guys installed some rootkits already. <!--emo&;)--><img src='http://www.unknownworlds.com/forums/html/emoticons/wink.gif' border='0' style='vertical-align:middle' alt='wink.gif'><!--endemo-->
<!--QuoteEnd--></td></tr></table><span class='postcolor'><!--QuoteEEnd-->
Thanks ill switch it over to a different user.. The directory is actually from a regular user account but I wasn't sure how to start a process as a different user in /etc/rc.local (startup file). If you know how that would be great but for now ill start process up manually. <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
su JoeUser -c "SomeCommand"
Bandwidth Ussage:
Outgoing rates: 82570.4 kbits/sec
04:36:53 up 437 days, 2:53, 1 user, load average: 0.01, 0.04, 0.00
54 processes: 53 sleeping, 1 running, 0 zombie, 0 stopped
CPU0 states: 0.0% user 0.0% system 0.0% nice 0.0% iowait 100.0% idle
CPU1 states: 1.0% user 0.0% system 0.0% nice 0.0% iowait 98.0% idle
CPU2 states: 26.0% user 0.0% system 0.0% nice 0.0% iowait 73.0% idle
CPU3 states: 2.0% user 0.1% system 0.0% nice 0.0% iowait 96.0% idle
Mem: 2064444k av, 1953960k used, 110484k free, 0k shrd, 113444k buff
688296k actv, 120k in_d, 44744k in_c
Swap: 1670720k av, 0k used, 1670720k free 1326808k cached
Outgoing rates: 82570.4 kbits/sec
<!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
82 MBit/s? That's just a tad big high there. With 22 players we pull about 400-500 Kbit/s to the server, and 600-700 Kbit/s out from the server (ie 1 to 1.2 MBit/s combined).
82570.4/8 (binary conversion)
=
10321.3/1024
=
10.07939453MB/s
Almost a full 100Mb/s pipe.
Who were you talking to? No one confused bits with bytes in this thread.
Yes, 82Mbit/s is almost a full 100MBit/s pipe (in one direction).
15 servers? 15 game server processes you mean?
I still don't believe you. Even if you had 15 30-player HLDS servers constantly full--which you don't have enough horsepower for even with hyper-threading--that would be less than 40Mbit/s combined up/down. Besides which, your response did nothing to answer the question of bandwidth usage for an NS2.0 server. That was the topic.
Who were you talking to? No one confused bits with bytes in this thread.
Yes, 82Mbit/s is almost a full 100MBit/s pipe (in one direction). <!--QuoteEnd--> </td></tr></table><span class='postcolor'> <!--QuoteEEnd-->
bah, ignore me.....where is my crack pipe?