Jump to content
  • 0

mangos on linux: cpu usage


levk

Question

Hello community,

I am new to your community :) I used to run my own WoW servers a few years back but I took a break for a while. Curiosity about advancements in the field brought me back.

Anyway, I compiled the latest revision of MaNGOS with ScriptDev2 (latest rev as well) and using UDB 12.2 on Ubuntu x86 12.04 server. I noticed an interesting event happening: mangosd was using a minimum of 25% of my cpu (running on a VPS with one core reserved). I have vmaps enabled.

realmd is using a minimum of 1-2% of cpu as well.

There are no users on the server.

What do you guys think? Is that normal or there is a bug somewhere?

Lev

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

I have experienced a similar issue on both mangos-zero and mangos-one using two vastly different linux systems. My most recent test yields about 33% cpu usage when idle:

- latest mangos-one master as of today (s1667, 7ff12b80)

- release build

- Fully updated gentoo hardened system

- Linux 3.4.5 x86_64

- Both the mangos-one supplied ace and the system supplied ace were tested

- gcc 4.5.4

- AMD Athlon 64 X2

Different machine, similar test with an older mangos-one resulted in ~11% cpu when idle:

- older mangos-one master (s1569, f4adf23e)

- release build

- some old ubuntu system

- linux 2.6.35 x86_64

- only mangos-one supplied ace was tested

- gcc 4.4.5

- Intel Core i3

I've also talked with other people that also have a high cpu load when idle. Sadly I've lost contact with these people so I can't supply any information about the systems they are running. Does anyone have more information? I suspect that maybe the 64 bit builds might be affected, but I don't have any other (32 bit) systems to test it on at the moment.

Link to comment
Share on other sites

How are you measuring CPU usage? I am checking cpu usage with "uptime" command. And without any players mine shows 0.07, 0.04, 0.00 (Mangos One).

On another server (zero) i have this: 0.33, 0.31, 0.24 (With about 20 players).

I do not see the problem this. Since it has never grown over 0.40. Try doing the same test on a physical computer and see if it gives a different response. Also check the update time diff ingame and see how much it differs.

Link to comment
Share on other sites

What do you guys think? Is that normal or there is a bug somewhere?

Normal for one core.

How are you measuring CPU usage

you can use top or htop (if you like it colorful).

top | grep mangosd

Regards

Skirnir

PS: For me idle with rev 12080

 3330 skirnir       20   0  899m 310m 9368 S   9,0  7,8   0:24.46 mangosd

Link to comment
Share on other sites

the cpu usage seen on (some?) linux machines is definitely not normal. I've repeated my second experiment on windows with the exact same hardware. On the exact same hardware going from linux to windows resulted in a cpu usage drop from 11% to 0% when idle. I'm confident I will see the exact same results on my other computer that has 33% cpu usage when idle, but that computer is critical to my network and I can not repurpose it for testing.

There is no reason to not trust the cpu usage output of top, ps, or htop. Additionally, uptime's load number is not just cpu usage, it also represents the IO load of your system.

Link to comment
Share on other sites

Hmm, strange, so I guess it is indeed some machines. On my dev machine, my MaNGOS One isn't doing a lot when it's idle:

PID USER   PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
3929 evil   20   0  232m 132m  12m S    1  3.6   0:15.65 mangosd

Obviously this is a snapshot in time, and perhaps I should monitor it for a bit longer than staring 5 minutes at top, but I have yet to see it go higher than this 1% when I'm not playing.

Link to comment
Share on other sites

[email protected]: Is your system a 32 or 64 bit system? Just a snapshot should be enough to verify if your system has the same issue, mine is on 33% cpu always, as soon as it's done booting up and goes into idle state. The cpu usage also stays high when a few players connect, but I've never really tested with more than 5-6 people.

I've been running mangos in valgrind with the callgrind tool, but the result means little to me at this point. I've not yet had time to really look into callgrind, if someone else has experience with profiling CPU usage and can chip in some data/info that would be nice.

Link to comment
Share on other sites

It's a 32-bit system. I'm wondering: perhaps the difference comes from something I disabled in the configuration while you didn't. AHBot, for instance, or mmaps. Do you have those enabled?

And there's only me and a few friends here, so I never checked CPU usage when a few players are actually playing :)

Link to comment
Share on other sites

My config file is mostly default with a few things changed to my liking (logging, cross faction). I just explicitely tested with a pure default config file and there was no difference in cpu usage at all, still sky high when idle. Still playing around with valgrind/callgrind, hopefully I can get something useful out of it.

Edit: I just tried disabling all vmap/mmap options, that had no effect either.

Link to comment
Share on other sites

I've been able to locate where the problem starts, there appears to be an insane amount of overhead in the threading system. If you go in your config file and put Console.Enable to 0 the server will spawn 1 thread less and the CPU drop is considerable (mine goes from 33% to 28%, a friends goes from 36% to ). Then, to further confirm that the threading system seems to give too much overhead you change Network.Threads to a higher number (say 5 or 10) and you'll see the cpu usage shoot up, even though all these threads are idle.

Now the question is, why is this overhead present on linux but not on windows... still looking into it, but hopefully I've made some other people curious that want to dig into this problem too!

Link to comment
Share on other sites

Further investigation seems to suggest the cpu usage is caused in the individual threads and not in the threading system itself. I've fixed the CliRunnable thread so enabling console will not cause additional cpu usage anymore. I sumbitted a patch to -one, if anyone could test the patch on the other versions of mangos that would be nice.

Still going to look into the remaining cpu usage, will post updates when I have them.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use