Jump to content

Question about Mangos and Swaping on Linux


Guest desteny_

Recommended Posts

I know its not realy a mangos related question, more then less a linux / unix question, but i think much of you know the answer and i need to learn a bit about linux ;)

if swap is enabled mangos begins to slow down (high diff) cause of swaping.

i know that i can configure "vm.swappiness=0", but this causes also swaping if the ram ammount is consumed.

if i deactivate swap completely i know the core will crash for shure, but how the OS reats?

for example if not the mangos process will use the last memory, but maybe the OS, or MySQL process? probabably this process will crash not mangos. (never tested, but i think so)

is there a possibility to limit the max memory consumption for the mangos process only?

or is it possible to not allow swaping for the mangos process only?

what is the best practice in this case?

Link to comment
Share on other sites

Are you certain it is MaNGOS causing the heavy memory and swap usage?

If you do not have MySQL configured properly, the many table reads and writes will use a tremendous amount of swap, especially if you went with one of the three default configurations. The last choice, for large-scale enterprise server is meant for professional hardware. Unless you are running MaNGOS on Xeon server rack, that setting will overwhelm your average desktop computer.

You can configure how much disk swap and RAM is used by MySQL. If you have just a few players logged in, those values can safely be set to low numbers.

As a general rule, I set MySQL to use no more than 40% of total RAM and a swap space equal to double the total RAM.

Link to comment
Share on other sites

The answer depends highly on how much RAM and how many connected clients you have.

If you run out of RAM without swap, the computer will start lagging (nothing should crash). Even when you have swap enabled it will start lagging, because your swap partition is on a HDD which is slower than your RAM. I'd go with disabling swap if your MySQL server is on the computer. Instead buy some more RAM or use a dedicated MySQL server.

On two of my computers I do not use swap at all. In case you have 4GB RAM or more swap becomes useless. Maybe this will change with SDDs. Watching at the price, I refuse to kill mine with swapping ;-)

Regards

Skirnir

Link to comment
Share on other sites

In my testing case i use 4GB Ram (total amount)

mysql consumes not even 1GB on my setup, and mangos is the process who consumes the rest of the memory (except some system memory, not relevant amount).

for example ~400 ppl and 2 days uptime mangos has ~3GB memory amount, and with vm.swappiness=5 it begins to swap.

i have also tested with separated DB server (only mangos running on the test system).

and if mangos begins to swap it begins to produce high diffs.

of course i could even upgrade the server to 16 GB memory (and switch to 64 bit) but ATM i'm sitting on a 32 bit OS and 4GB memory limitation, but how ever i don't even want to consume more memory.

a other way could be to detect the mangos memory usage and restart mangos if it superates a certain ammount of memory?!

Link to comment
Share on other sites

in this test case i use a clean mangos one.

if player are starting to visit much zones the memory starts to grow very fast (not at least cause vmaps mmaps and so on) but it stops on ~3gb amount then it grows only slow, but how ever there must be mem leaks, but thats not the problem.

i think the best practice would be like Lillecarl says, bash script for kill.

on windows i have solved the problem by using 32 bit compiled core on 64 bit OS with more ram then 4GB, then the core crashs if it reachs 4GB, but no other programm is infected

Link to comment
Share on other sites

in this test case i use a clean mangos one.

if player are starting to visit much zones the memory starts to grow very fast (not at least cause vmaps mmaps and so on) but it stops on ~3gb amount then it grows only slow, but how ever there must be mem leaks, but thats not the problem.

i think the best practice would be like Lillecarl says, bash script for kill.

on windows i have solved the problem by using 32 bit compiled core on 64 bit OS with more ram then 4GB, then the core crashs if it reachs 4GB, but no other programm is infected

Nice windows solution, hehe xD

Link to comment
Share on other sites

No, Grid unload is enabled, thats not the problem.

but little memory leaks on mangos are known issue right?

the problem in this case is only the basic memory consumtion in combination with small leaks, but how ever i see that there is no generic solution for this problem, (no possibility to controll swaping only for a specific process or amount of memory)

the only idea that will comes to my mind is this:

if mangos runs normal, the diff would be not higher then ~200, maybe some peaks but not AVG.

if mangos has diff > 200 for 1 minute (for example) the core is swaping (or there is a problem), and the core will start shutdown 1 minute (including player save on shutdown).

Link to comment
Share on other sites

but little memory leaks on mangos are known issue right?

My small dedicated Mangos box has only 1 gig ram (win xp, tiny family & friends server).

But I'm guessing that with only 1 gig ram, in combination with a memory leak, these would never have been possible:

http://imageshack.us/f/823/up2l.jpg/

http://imageshack.us/f/513/up1r.jpg/

http://img193.imageshack.us/img193/2334/34206820.jpg

http://imageshack.us/f/42/10570710.jpg/

So since it never runs out of memory after these uptimes, i doubt there are severe memory leaks(?).

Link to comment
Share on other sites

but little memory leaks on mangos are known issue right?

My small dedicated Mangos box has only 1 gig ram (win xp, tiny family & friends server).

But I'm guessing that with only 1 gig ram, in combination with a memory leak, these would never have been possible:

http://imageshack.us/f/823/up2l.jpg/

http://imageshack.us/f/513/up1r.jpg/

http://img193.imageshack.us/img193/2334/34206820.jpg

http://imageshack.us/f/42/10570710.jpg/

So since it never runs out of memory after these uptimes, i doubt there are severe memory leaks(?).

WOW, Those uptimes are insane, but might be introduced in later revisions, as you must have a old core (daaat uptime)

But i can confirm that i am running my development server on 1 gig ram as well (actually 1.5 now since i run mangos on gdb 24/7 and dont want to shut down mangos for compiling) But it seems to keep a good memory state all time.

I am administrating a live mangos-zero server. So i just put im a "free -m printer"

check here http://kalimdorgaming.com/memorylog.txt to see memory usage on this server. It is running apache2, php, mysql, realmd, mangosd.

EDIT: Check only this line to see actual memory usage. The rest is cached data which would be put in swap on a windows box.

-/+ buffers/cache: (this shows "actual ram usage"

Regards

Link to comment
Share on other sites

So since it never runs out of memory after these uptimes, i doubt there are severe memory leaks(?).

You have a very low population and that might explain your situation. The topic starter said something about ~400 players and 2 days of uptime. With 8 users max, that would extrapolate to 100 days of uptime if number of players would be relevant.

For instance because the server isn't constantly leaking memory, but only a small amount when, say, a player logs in/out, or when a player checks his (g)bank or mail or something like that.

I'm not saying that's the case, I was merely giving a theoretical possibility here :P

Link to comment
Share on other sites

With a low population (talking about < 20) and not much visited map places (specialy on the big maps) the memory usage is very low and stable.

but with a higher amount of player things are changing

Did you read http://kalimdorgaming.com/memorylog.txt ? This is Zero, but i got no problems at all with unstable ram usage. Maybe you got a customization leaking somewhere? Or is this a clean mangos? Anyways. My 2.4.3 dev server doesnt seem to leak any ram either.

PS: Seen the application "valgrind"? Its able to trace memleaks on linux! ;)

Link to comment
Share on other sites

With a low population (talking about < 20) and not much visited map places (specialy on the big maps) the memory usage is very low and stable.

but with a higher amount of player things are changing

Did you read http://kalimdorgaming.com/memorylog.txt ? This is Zero, but i got no problems at all with unstable ram usage. Maybe you got a customization leaking somewhere? Or is this a clean mangos? Anyways. My 2.4.3 dev server doesnt seem to leak any ram either.

PS: Seen the application "valgrind"? Its able to trace memleaks on linux! ;)

Link to comment
Share on other sites

Last time I tried valgrind (maybe 3 years ago) my Core2Duo E8400 could barely handle two clients. Like to see how it handles 400 clients :)

Just restart mangosd (better the whole server) every night at 3 a.m. when nobody is online. One cronjob for the reboot and after boot run a automatic restarter.

Regards

Skirnir

Link to comment
Share on other sites

  • 1 month later...

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