[MUD-Dev] [TECH] Server Bottlenecks
Roy Riggs
roy at royriggs.com
Mon Sep 1 18:09:17 CEST 2003
From: Jim Purbrick
> 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.
I developed such a server for a high-availability e-commerce
application. The answer is going to depend on how many mutexes your
server has, and how long each thread typically runs while holding
the mutex. Also, you have to beware that odds are, your malloc() &
free() are behind a mutex so you can end up with a lot of contention
for the heap. (We use SMP libraries like SmartHeap to avoid that!)
But if most of the time each thread can be running and getting some
work done, the context switching isn't going to be your bottleneck,
it's usually the typical stuff: disk i/o etc. Of course any
threading is all going to be very OS specific, some OS's handle it
much better than others. What works great under Linux may not under
AIX, etc. You'll definitely want to keep a pool of threads sleeping
on a semaphore so when some new data comes in on a socket you can
wake up an existing thread instead of spawning a new one.
Cheers,
Roy
_______________________________________________
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