[erlang-questions] Building a Non-blocking TCP server using OTP principles

Claes Wikstrom klacke@REDACTED
Thu Aug 23 23:32:26 CEST 2007


Serge Aleynikov wrote:
> Despite the fact that aborting the application is also what's 
> implemented in the tutorial, this may seem questionable to be "the only" 
> reasonable recovery action as for some servers EMFILE can be a temporary 
> condition.  Suppose there was a spike of short-lived client connections 
> when the server might have hit the limit of file descriptors.  As some 
> client connections disconnect, the server's gen_tcp:accept/1 call may 
> recover automatically.  I could speculate that in selected cases it may 
> be more expensive to failover/recover state of some applications in a 
> node then to attempt several retries in a timely manner.
> 

Agreed, the hitch is how to - programatically - differentiate the
cases "temporary condition" and "permanently fucked". For most websites
the "permanently fucked" is more probable than "temporary condition".

My laptop mac:

[klacke@REDACTED]~ > ulimit -n
10240

When was the last time you had 10240 simultaneous HTTP connections.
My shoddy sites sure dont get that :-)
Anyway, that was just a case for the probability - In general I
agree with you.


Maybe try to redo the accept() .. say 10 times and then bail out
Hmmmm...


/klacke



More information about the erlang-questions mailing list