Re: http webserver using select()
- From: "Nils O. Selåsdal" <NOS@xxxxxxx>
- Date: Mon, 18 Sep 2006 13:37:03 +0200
Hubble wrote:
Nils O. Selåsdal wrote:Nils O. Selåsdal wrote:Thr wrote:"usual" was perhaps not the best word here. For such servers it'sHi,Depends on how you program the thing.
I read some books about network programming..
Still, I have some questions:
1. let's assume that we have http server written using nonblocking i/o
and select().
How is it possible to server many requests simultaneously?
I mean - we have, for example, static binary file that is 700 MB long
(and many other, much smaller files, that are, for example, html
webpages)
.
Let's assume that server found new socket descriptor with select(), and
accepted it..
after receiving data from client, and after parsing request header we
found that he want this big file, and we started to send him chunks of
data..
I think that this situation should block sending data for other
clients, does it (until this 700 MB file is send) ?
What one usually does is place the fd(set it to nonblocking first) in
the write set for select.
also common to fork a child or spawn a thread that handles each client.
AFAIK, squid (www.squid-cache.org) is a famous example which does use
neither thread nor fork and achieves very good performance.
Yaws is a better one, but performance wasn't my point :-)
For some applications you do need a seperate execution path per
client, as backends (e.g. PHP) that runs in the same process as
the serving one can do blocking calls.
.
- Follow-Ups:
- Re: http webserver using select()
- From: William Ahern
- Re: http webserver using select()
- From: David Schwartz
- Re: http webserver using select()
- References:
- http webserver using select()
- From: Thr
- Re: http webserver using select()
- From: "Nils O. Selåsdal"
- Re: http webserver using select()
- From: "Nils O. Selåsdal"
- Re: http webserver using select()
- From: Hubble
- http webserver using select()
- Prev by Date: Re: Understanding ping program
- Next by Date: Re: Understanding ping program
- Previous by thread: Re: http webserver using select()
- Next by thread: Re: http webserver using select()
- Index(es):
Relevant Pages
|
Loading