* Friedrich Locke <friedrich.lo...@gmail.com> [2012-11-13 00:05]:
> i am planning to write a simple web server. My initial ideia for this
> server is that it will only serve static content.
> So, i would like to have the best possible performance.

you are reinevnting the wheel, to put it nicely.

> I don't feel like going for multiple process since i would like to reduce
> context switch required by multiple process send data to clients. I would
> like to implement it using kqueue.

you're looking for libevent, then.

> A connection multiplexer process listens for incoming connections on port
> tcp/80. When i new connection arrives it (the process) accepts it (the new
> connection) and sends the fd from the incoming connection to one of the n
> http server process instances and from that point on the http server
> process handles it.
> 
> Second approach:
> 
> Starts a http server process. This process opens a socket for listening
> incoming connection on port tcp/80. Than, this process forks n-1 processes.
> These n-1 process will share the listening socket and starts listening to
> this socket too. When a new connection arrives, the kernel wakes up one of
> the n proccess and this one handles the incoming connection. While this
> process is serving a request, we will have n-1 process listening and if a
> new connection arrives the kernel wakes up one of the n-1 process and do
> everything again and again ....
> 
> I am no OpenBSD kernerl expert. I would like to hear from which of the
> approaches would deliver better performance (this is critical for me).

I doubt there is any significant difference at all.

> What you have to say.

use nginx.

-- 
Henning Brauer, h...@bsws.de, henn...@openbsd.org
BS Web Services, http://bsws.de, Full-Service ISP
Secure Hosting, Mail and DNS Services. Dedicated Servers, Root to Fully Managed
Henning Brauer Consulting, http://henningbrauer.com/

Reply via email to