Using UNIX sockets with Erlang (OT)
Klacke
klacke@REDACTED
Wed Sep 19 14:01:27 CEST 2001
> (attached) If i do 50 requests from 20 clients, (1000) about 20 of them
> fail with "connection refused". Am i doing something wrong or is this
> expected behaviour?
>
Ok, "connection refused" is what you typically get when the listen
backlog queue is full on the server machine. You get this because
there is time-gap in your code where nobody is accept() 'ing.
You need to make sure that there is always some code that sits
in accept(). One way is to pre spawn the worker process, do the
accept, send the socket to the pre spawned process, and then
accept() again.
There is also a {backlog, Num} option that can be passed to
listen().
Another observation is that the regex and string handling in
your code will make it slow. However, that's not your fault, it's
erlang strings that suck. Maybe use binaries.
/klacke
--
Claes Wikstrom -- Caps lock is nowhere and
Alteon WebSystems -- everything is under control
http://www.bluetail.com/~klacke --
More information about the erlang-questions
mailing list