[erlang-questions] why is gen_tcp:send slow?

Rapsey rapsey@REDACTED
Fri Jun 20 12:38:55 CEST 2008


The proxy is not building up a queue, because {active, once} is set after
every packet has been sent to the other side.
Streaming server keeps a close eye on the message queue and it does not
allow it to grow by much.



On Fri, Jun 20, 2008 at 12:04 PM, Adam Kelly <cthulahoops@REDACTED> wrote:

> 2008/6/19 Rapsey <rapsey@REDACTED>:
> > The transmit could of course be written with a passive receive, but the
> code
> > would be significantly uglier. I'm sure someone here knows if setting
> > {active, once} every packet is CPU intensive or not.
>
> Is the streaming process building up a message queue (a back log of
> messages waiting
> to be sent?).  gen_tcp:send does a selective receive in order to
> acknowledge that the
> packet has been sent, so if the process has a message queue it has to
> do a linear search
> of the message queue on each send and the streaming becomes O(N^2).
>
> Adam.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080620/95084a00/attachment.htm>


More information about the erlang-questions mailing list