Jump to content

[Multi-Thread Patch] Movement Thread


Guest Woweur

Recommended Posts

What bug does the patch fix? What features does the patch add?

My patch add a thread to handle a movement opcode. I have write this patch for reduce the session update diff. For example, with 1.2k plr, the session update diff is ~300ms without the patch. With the patch, the session update is ~5 ms. The major problem is to fix some deadlock with lock or other ...

For which repository revision was the patch created?

9113

Who has been writing this patch? Please include either forum user names or email addresses.

Me

Of course, you can post a crashlog ...

If you can, aslo post the uptime you have with the patch or other bug due to the patch ...etc

Crashlog list :

http://paste2.org/p/597363

http://paste2.org/p/597366

http://paste2.org/p/597368

Github :

http://github.com/Izidor/mangos/tree/MovementThread

Patch :

http://paste2.org/p/596791

Link to comment
Share on other sites

Yes, i think it's a good idea. I will make that tomorrow ;)

I have fixed a crash in ClientGUID iterator in class player with a LockedSet (like LockedQueue implanted by MaNGOS).

Nobody has tried the patch ?

EDIT : i have added a crashlog list in a first post.

Link to comment
Share on other sites

this patch looks interesting, had just a quick look and noticed you are reading from the config file on every update call: sConfig.GetBoolDefault("MovementThread", false) ...

about World::UpdateMovementOpcode(): i am wondering why you re-check for session validity, it should be easier (and faster) to lock the mutex before getting the session first time and avoid a double-call. in 99.9% of all cases a player WILL be logged in when mangos receives a movement opcode.

correct me in case i'm wrong.

EDIT: avoiding this double-check would also possibly fix the deadlock problem - or you use a ACE_Guard<ACE_Thread_Mutex>(mutex) and create a locked scope instead of using explicit acquire()/release() calls, thats a lot safer (would get you rid of the mutex.release() after LogoutPlayer() also)

last thing: why are you starting the thread with lowest priority..?

Link to comment
Share on other sites

Yeah, i think it's better to use a bool in World class for "sConfig.GetBoolDefault("MovementThread", false)".

I recheck the session because if i don't do that, i have a crash with delete pointer, and with this recheck, i haven't crash related to that. For a mutex, yes it's maybe better to use ACE_Guard. Why i have starting the thread with lowest priority ? Because i think the main thread must have the priority, a movement isn't realy important than cast spell, update ..etc.

EDIT : i have added a link to a github in first post :)

EDIT 2 : i have maybe a idea to fix some deadlock, if in all function where TypeContainerVisitor is used, i use a ACE_Guard , this can be work no ?

Link to comment
Share on other sites

using many mutexes and a lot of sync/locking will likely make an app slower then using no threading at all. i suggest you read some info about what to take care of when writing multithreaded apps.

it makes only sense putting these parts into an own thread that that use much CPU time and that can run without requiring too many resources from other threads that require locking (e.g. to ensure that pointers are valid, etc).

Link to comment
Share on other sites

using many mutexes and a lot of sync/locking will likely make an app slower then using no threading at all. i suggest you read some info about what to take care of when writing multithreaded apps.

it makes only sense putting these parts into an own thread that that use much CPU time and that can run without requiring too many resources from other threads that require locking (e.g. to ensure that pointers are valid, etc).

Your explanation makes enough sense to not have to read more info on it.

Link to comment
Share on other sites

×
×
  • 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