high performance server design approach

Erich Dollansky erichfreebsdlist at alogreentechnologies.com
Tue Nov 13 10:39:56 UTC 2012


Hi,

On Tue, 13 Nov 2012 08:23:38 -0200
Friedrich Locke <friedrich.locke at gmail.com> wrote:

> 0) To have a single process "accepting" incoming connection on port
> 80 and send the new socket fd to one of the http server in a
> round-roubin manner, or

if you have N cores, create N - X processes or threads for handling the
requests. Leave at least one core for the OS, so, have X >= 2.

I would not fork at all. Have the threads ready when the requests are
coming.

At least this is what I did several years ago achieving the highest
performance. Make X a variable to be able to tune a bit.

You also should have a memory pool available to avoid calls to malloc
and free. You must have a limit for the memory pool. Free the memory in
the pool time to time so others can make use of the memory too.

> The first approach leads to n+1 process. The second to exactly n
> process.

You need at least one core for handling the tasks of the OS. If I
remember right, I took 10% of the cores plus one which I did not use
and I took at least one core.

This is all from memory. So, please consider that I could have missed
something out.
> 
Erich


More information about the freebsd-questions mailing list