[erlang-questions] [ANN] misultin v0.7

Per Melin per.melin@REDACTED
Sun Apr 10 21:26:07 CEST 2011

On Sun, Apr 10, 2011 at 7:56 PM, Loïc Hoguin <essen@REDACTED> wrote:
> On 04/10/2011 07:35 PM, Max Lapshin wrote:
>> You are speaking about stability and use blocking, unstable technique
>> of listening and reading sockets:
>> https://github.com/extend/cowboy/blob/master/src/cowboy_acceptor.erl#L34
>> I advise to read this:
>> http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles
> An acceptor process only accepts, it can be killed and restarted
> without any fear of losing anything, which is why their supervisor
> uses brutal_kill in the child spec. The listened socket is controlled
> by a different process which makes killing acceptors a complete
> non-issue.

I have a web server I wrote before Mochiweb* was open sourced, and
it's been running in production since. It handles accept in a fashion
very similar to Cowboy. It is doing 30-40 million requests per day and
has been through many live code updates and I've yet to have a problem
with it.

Though what has caused problems in other applications with high
throughput is gen_tcp:send/2 blocking. So there are places we go
directly to erlang:port_command/2 instead. Once you get a {inet_reply,
Socket, ok} message back from the driver you know you're safe to push
more data on the port without blocking.

* I've thought about switching to Mochiweb a few times since, but I
have an irrational fear of bloat, and all the arbitrary modules plus
the kitchen sink you get with it have put me off.

More information about the erlang-questions mailing list