Date: Thu, 27 Apr 2000 16:49:34 -0600 From: Wes Peters <wes@softweyr.com> To: A G F Keahan <ak@freenet.co.uk> Cc: "Richard Seaman, Jr." <dick@seaman.org>, Jason Evans <jasone@canonware.com>, freebsd-hackers@FreeBSD.ORG Subject: Re: Multithreaded server performance Message-ID: <3908C3FE.ABD80977@softweyr.com> References: <3903AEA6.FA7CBBAB@freenet.co.uk> <20000423212115.E31925@sturm.canonware.com> <20000424164405.G370@seaman.org> <390501AB.D185646E@freenet.co.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
A G F Keahan wrote: > > > On Sun, Apr 23, 2000 at 09:21:15PM -0700, Jason Evans wrote: > > > > > > This design isn't ideal on any OS, but the fact that you do significant > > > processing every time a request arrives on a socket probably hides most of > > > the inefficiency due to thread switching and lack of cache locality due to > > > many thread stacks. > > Can you suggest a better design for this type of server application > under FreeBSD? Perhaps a combination of forking (or pre-forking) and > threads? Preallocate a number of threads that yeilds adequate peformance and feed work to the threads via IPC mechanisms. When the thread finishes its work, rather than exiting, it just waits for another work unit. A simple way to do this is via a queue, or via a shared memory pool for each thread and a "go" semaphore. This avoids the overhead of thread startup and shutdown for every client connection. -- "Where am I, and what am I doing in this handbasket?" Wes Peters Softweyr LLC wes@softweyr.com http://softweyr.com/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3908C3FE.ABD80977>