[erlang-questions] Re: Unicast 20k messages, $500-$1000 bounty
Ulf Wiger
ulf.wiger@REDACTED
Fri Jul 17 12:39:16 CEST 2009
Joel Reymont wrote:
> Jim,
>
> On Jul 17, 2009, at 11:12 AM, Jim Morris wrote:
>
>> It is Socket programming 101 that writes can block when the TCP
>> receiver does not read and the flow control causes the TCP buffers to
>> backup.
>
> This all makes sense. I will redo the code using just 1 middleman
> process then.
You may want to consider the following passage from the inet man page
on setopts/2:
{delay_send, Boolean}
Normally, when an Erlang process sends to a socket, the driver will try
to immediately send the data. If that fails, the driver will use any
means available to queue up the message to be sent whenever the
operating system says it can handle it. Setting {delay_send, true} will
make all messages queue up. This makes the messages actually sent onto
the network be larger but fewer. The option actually affects the
scheduling of send requests versus Erlang processes instead of changing
any real property of the socket. Needless to say it is an implementation
specific option. Default is false.
I'm not sure if setting {delay_send, true} would have any beneficial
effect on your particular problem, but the text does shed some light
on the semantics of sending to a socket.
BR,
Ulf W
--
Ulf Wiger
CTO, Erlang Training & Consulting Ltd
http://www.erlang-consulting.com
More information about the erlang-questions
mailing list