Date: Tue, 13 Nov 2012 17:39:52 +0700 From: Erich Dollansky <erichfreebsdlist@alogreentechnologies.com> To: Friedrich Locke <friedrich.locke@gmail.com> Cc: freebsd-questions@freebsd.org Subject: Re: high performance server design approach Message-ID: <20121113173952.14e12497@X220.ovitrap.com> In-Reply-To: <CANMDHqfuEYw=hDRN2MUPao50cS9UkhzOsqeVnhSNzp8g9RUd4A@mail.gmail.com> References: <CANMDHqfuEYw=hDRN2MUPao50cS9UkhzOsqeVnhSNzp8g9RUd4A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, On Tue, 13 Nov 2012 08:23:38 -0200 Friedrich Locke <friedrich.locke@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121113173952.14e12497>