Re: Best Performance Server Strategy(Probably OBSD OffTopic)

2012-11-30 Thread Henning Brauer
* Friedrich Locke  [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/



Re: Best Performance Server Strategy(Probably OBSD OffTopic)

2012-11-13 Thread Friedrich Locke
Where i wrote listen i really meant accept.

On Mon, Nov 12, 2012 at 9:04 PM, Friedrich Locke
wrote:

> Hi folks,
>
> 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.
>
> 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. On a single cpu/core machine it is
> fairly simple to solve, but when in SMP/multicore machines i could take two
> approaches (Suppose we have n cores in the system):
>
> First approach:
>
> 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). What
> you have to say.
>
> Thanks a lot for your time and cooperation.
>
> Best regards,
>
> Fried.



Re: Best Performance Server Strategy(Probably OBSD OffTopic)

2012-11-12 Thread Eric Furman
Your clear solution is Tru64.

On Mon, Nov 12, 2012, at 06:04 PM, Friedrich Locke wrote:
> Hi folks,
> 
> 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.
> 
> 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. On a single cpu/core machine it is
> fairly simple to solve, but when in SMP/multicore machines i could take
> two
> approaches (Suppose we have n cores in the system):
> 
> First approach:
> 
> 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).
> What
> you have to say.
> 
> Thanks a lot for your time and cooperation.
> 
> Best regards,
> 
> Fried.



Best Performance Server Strategy(Probably OBSD OffTopic)

2012-11-12 Thread Friedrich Locke
Sorry for the last message. I did not finnish and hitted send wrongly.