mangosR2 / mangos

Production (stable and testing) versions of current mangosR2 v2 server (World of Warcraft: Wrath of the Lich King, 3.3.5a client).
http://mangosr2.2x2forum.com/
GNU General Public License v2.0
175 stars 77 forks source link

High update diff on MapMgr #1402

Open Undergarun opened 11 years ago

Undergarun commented 11 years ago

Since couple of weeks ago, i notice a MapMgr load some ticks good 50-200ms and others significantly high, 400 - 700 ms. Is possible any improvement to speedup something on MapMgr to avoid "server delay"?

P.D: vmap.Dynamic.DoubleCheck = 0 and 1000 ppl

rsa commented 11 years ago

this long time, or some time ago? don't remember any big changes for CPU use last year...

rsa commented 11 years ago

PS what your visibility radiuses in config?

Undergarun commented 11 years ago

3-4 weeks ago. But now more players than month ago, so source possible older.

Visibility.GroupMode = 0 Visibility.Distance.Continents = 90 Visibility.Distance.Instances = 400 Visibility.Distance.BGArenas = 180 Visibility.Distance.InFlight = 100 Visibility.Distance.Grey.Unit = 1 Visibility.Distance.Grey.Object = 10 Visibility.RelocationLowerLimit = 10 Visibility.AIRelocationNotifyDelay = 1000

rsa commented 11 years ago

may be new mmap quality? try disable.

Undergarun commented 11 years ago

How? Disabling whole mmaps?

rsa commented 11 years ago

no, tempdelete mmap files from one map (with max lags) and see on result.

Undergarun commented 11 years ago

Mmmmm seems to be related to Spell System. Getting back MaxSpellCastInChain to 25 seems to decrease load significatly, so possible some spells with endless trigger castings. U.u

rsa commented 11 years ago

possible... need string with this limitation from your logs.

Undergarun commented 11 years ago

Getting back to mmaps checks, still high MapMgr with high population. Is not the same adding maps ids to mmap.ignoreMapIds config param than delete mmap files from folder?

rsa commented 11 years ago

same,but not requires config reload.

Undergarun commented 11 years ago

Confirmed, mmaps issue. Good performance with mmaps = 0

rsa commented 11 years ago

mmaps requires many CPU time as intenended. possible solution - 1. lower MMAP quality (as before last changes) 2. increase the parallelization of the processing (currently i'm try this).

mns commented 11 years ago

MTMMAP :D

Undergarun commented 11 years ago

Seems as without mmaps load decreased (Obviously, less cpu resources needed) but still high update diff in MapMgr, so possible not related to changes in mmaps. Let's continue with work on paralelizing but please, check cause on other possible places.

Thank you!

Undergarun commented 11 years ago

Does "SoftIRQ" indicate high locking?

See this:

softirq

leyend

Dedicated R2 machine. No MySQL or any other software running then OS. Whole activity comes from R2 runtime.

MapUpdate.Threads = 10 MapUpdate.DynamicThreadsCount = 1 VMSS.Enable = 0

rsa commented 11 years ago

no. "softIRQ" not related to user task (like mangos) always, and indicate very high rate of IO operations, maked by kernel. this - file IO, network IO. need make some file operations (like logging, vmaps/mmaps reading) asynchronous... very good diagram. optimal CPU load.

Undergarun commented 11 years ago

Without [mr2958] ab430e089c0f6909dc6c651215db31eeeffdee0b, [mr2959] 366282a02ea91b4629aaeb7c4aa952e914bf6ec5, [mr2960] f372ae0c4f176a7c435b1cebd1fa2fb008e056a0, [mr2956] 4e83d6ef6e4d27352450e7862e49f28edf839d91

Some crashes:

In Map::SendObjectUpdates: http://pastebin.com/uLaM3B5c

In Map::FindObject: http://pastebin.com/mBjEC2QD

rsa commented 11 years ago

first - please, point me to src/game/Map.cpp:2219 in your source, second - in 2962

Undergarun commented 11 years ago
            obj->BuildUpdateData(update_players); in void Map::SendObjectUpdates()
Undergarun commented 11 years ago

Till [mr2957] stable. Singleton locks seems to cause freezes. MapPersistentSate cycle test in progress.

rsa commented 11 years ago

use singleton locks instead of manual not must cause any freezes (in theory :). but this may identify weaknesses in the code

Undergarun commented 11 years ago

Please, check possible weaknesses. If MapPersistentState changes stable, i'll continue testing with "Null locking in ObjectAccessor" and then back to singleton locks.

"lock in BuildObjectUpdates" also under testing, hopefully no issues here, and other crash fixed.

Thank you.

Undergarun commented 11 years ago

Notice weird behaviour, more players == stable. Less players == unstable. I'm having crashes from 9:00 am to 15:00 pm and then nothing... if server crash during stable period, it'll be crashing till next load peak.

Undergarun commented 11 years ago

http://pastebin.com/4iGP4W2n VMSS on. http://pastebin.com/Z74ZqmTi

rsa commented 11 years ago

VMSS make output in regular logfile. first dump - normal crush (must be correct handled by VMSS), second - broken (no point for search).

Undergarun commented 11 years ago

Possible source of HighUpdateDiff on MapMgr in:

SpellCastResult Spell::CheckCast(bool strict) caused by taking too long grid searchers due to "[mr2858] Fix searching for nearest creatures/gameobjects".

This the last possible source since is not a mmaps issue and not MaxSpellCastInChain. I revert this commit and i'll be test performance on next hours.

rsa commented 11 years ago

thx. possible need some simplify in grid search.

Undergarun commented 11 years ago

Just a little bit faster (50-70ms), but low diff still needed! :(

rsa commented 11 years ago

after https://github.com/mangosR2/mangos/commit/c0b572a1df0f41ad6272db6682b172d858bcd488 https://github.com/mangosR2/mangos/commit/393907556afdc37cb0c012e89751669d4fba12c6 https://github.com/mangosR2/mangos/commit/e2d3432ad40d6a8c6da8c5478e2db877fde2d14f my test server (10s grid unload + 100 random bots) not crushed oved 6hours (before - crush every 3-4 hour). avg load less on 3-4% then before, update diff stable. try also check vmap.Dynamic.DoubleCheck option - many CPU required.

Undergarun commented 11 years ago

http://pastebin.com/m3wnDbcZ Heavily unstable with MapPtrs... also false freezes detect.

vmap.Dynamic.DoubleCheck disabled for now, till less update diff.

Undergarun commented 11 years ago

Question: You know why sWorld.Update(diff); in WorldRunnable::run() loop start with ~50ms of diff?

Undergarun commented 11 years ago

Answer: #define WORLD_SLEEP_CONST 50 XD Forget the question!

Undergarun commented 11 years ago

As i understand MapMgr diff == Map.UpdateThread with highest Update() time, right? And till all MapUpdateThreads complete its Update() cycle, World::Update does not continue. Am i right?

rsa commented 11 years ago

right, but not full - diff NOT LESS then higest map update time (thread may work with some small maps before 571 update). also currently world thread may continue - guard timer implemented, but only 2-3 times :)