web server

Claes Wikstrom klacke@REDACTED
Mon Jun 21 23:23:47 CEST 1999


> 
> hi,
> 
> Looking through the inets code, It seems to me that the web server is
> single threaded.  The only spawns I saw were for the listen socket.
> I'm wrong, right?  

It's multithreaded allright,  Looking at the code in
httpd_listener.erl I see the following sequence of
events.

- First a connection/4 is spawned in init/1

- A soon as as this process has accepted a socket, it
  cast's a {create ... message to the server, which immediately
  spawns a new connction/4 process.

Thus unless the number of active processes/socket go
over some config number there will always be one and exactly
one erlang process ready to accept the next socket.

The exception being the short interval between one
call to accept and the next, but there the kernel will
buffer the incoming connection request. 

/klacke



More information about the erlang-questions mailing list