tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Common daemon models (was: getcontext()/setcontext()/makecontext() reliability?)



On Thu, 3 May 2012 23:27:31 -0400
Matthew Mondor <mm_lists%pulsar-zone.net@localhost> wrote:

> > I'm looking into getcontext()/setcontext() because I think that its
> > overhead may be way less than POSIX threads for an I/O server with
> > potentially hundreds or thousands of active sessions.  Not so?
[...]
> If the service is very I/O-bound and not CPU-bound, the fastest would
> be to maintain custom state, custom buffering, non-blocking
> descriptors, with a good events loop 
[...]
> A single process/thread may handle many clients very efficiently this way
I have some experience in this departement also.
I completely agree with Matthew. Keeping custom state in a
per-connection state object and multiplexing around kqueue(2) will be
most efficient. Depending on what you have to do it may be easy to
extend this to multiple worker threads in a single proess context to
exploit SMP.

But, das Matthew writes, do your homework first:
> So obviously one has to first evaluate the application needs
> before immediately using a specific model...

BTW: Google "c10k problem"...
-- 


\end{Jochen}

\ref{http://www.unixag-kl.fh-kl.de/~jkunz/}



Home | Main Index | Thread Index | Old Index