[FIXED] cChunkSender
#1
I'm about to add a new thread to MCS, and I thought I might announce it here so that others know what's going on when they run into similar issues that caused me to consider it.

Right now, if a client connects into a world that has been deleted, lots of chunks need to be generated for that user. And the generation process is painfully slow, because the Tick-thread keeps trying to load the chunks over and over again. This actually makes the WorldStorage thread, the Tick-thread and the ChunkGenerator-thread all spin in useless loops - chunk is queued for loading, then attempted to load, which fails, so it is queued for generating, only to find out it's already queued for generating.

On my machine I've observed behavior of 40.000+ threadswitches on each of the three threads.

The real problem lies in the fact that the Tick-thread is using active polling to send outstanding chunks. This is never good. Also IMO the chunks should not be sent in the Tick-thread, because they take time to compress into packets, time that the Tick-thread then lacks.

The best solution that comes to mind is to make (yet) another thread that would wait for the "chunk became valid" event and sending such chunks to clients at that moment.
Reply
Thanks given by:


Messages In This Thread
[FIXED] cChunkSender - by xoft - 02-29-2012, 01:12 AM
RE: cChunkSender - by xoft - 03-07-2012, 05:19 PM



Users browsing this thread: 1 Guest(s)