[MUD-Dev] [TECH] Server Bottlenecks

Sean Kelly sean at ffwd.cx
Wed Sep 3 13:40:31 CEST 2003


On Mon, 1 Sep 2003, Jim Purbrick wrote:

> Where are the normal bottlenecks in server scalability? I've seen
> a lot of posts suggesting that thread-per-connection
> implementations limit scalability due to context switching. Are
> there any tools for Windows/Linux for diagnosing context switching
> problems? I've <cough>inherited</cough> a multiple thread per
> connection network library and will need to prove that its the
> limiting factor before I get to change it. Where else are server
> bottlenecks found and which tools are useful for finding them? As
> the context switching issue shows, straight profiling isn't always
> enough.

Every thread has its own stack frame as well as some other info.  So
every context switch has to discard the old thread's data and load
the new thread's data.  For a small number of threads (5-10) this
isn't a big deal, but in massively threaded applications it's quite
possible for the CPU to spend more time context switching than it
does actually executing instructions within the threads themselves.
Under Windows, the suggested method for handling a large number of
concurrent connections is IOCP (Completion Ports)--it's basically a
callback mechanism with a thread pool.  Under Linux I believe the
comparable method is using epoll.  Justifying the theory is easy,
just pick up any book on multithreading and you'll likely see
mention of this issue.  I don't know of any tools that specifically
track kernel vs. application level CPU time, however.

Sean
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the mud-dev-archive mailing list