[erlang-questions] gen_tcp/ssl send function and large binaries, should I split?
Thu Jan 2 12:04:44 CET 2014
As always with these things you should measure your specific scenario and
see if it is worth it for you.
Purely theritically I would imagine that the above loop would add a
little bit of overhead, mainly from the fact that the total number of
function calls goes up. The C code in the inet_driver should be largely
unaffected by this as it would only append the data to its own queue. I
would be surprised if you could measure any difference in throughput.
So I would recommend using the simpler `Transport:send(Socket, Data)`
unless you actually can measure a difference.
: for gen_tcp, I don't know much about how ssl does things, the
encryption parts could effect this.
On Mon, Dec 30, 2013 at 12:58 PM, Benoit Chesneau <>wrote:
> Hi all,
> Actually when I send a large binary I split it chunk of 64MB and loop
> until the end:
> send(<<Data:65536000/binary, Rest/binary >>, Transport, Socket) ->
> Transport:send(Socket, Data);
> send(Data, Transport, Socket) ->
> Transport:send(Socket, Data).
> But I wonder if it's really useful, Does gen_tcp:semd and ssl:send take
> care about it? Should I just use `Transport:send(Socket, Data)` ?
> - benoit
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions