Sendfile in erlang

Luke Gorrie <>
Fri Nov 14 16:36:58 CET 2003

Miguel Barreiro <> writes:

> ObPerfData: a cycle of file:read() and gen_tcp:send() moving 4KB chunks
> over 1000Base-T between 1GHz Pentium3 machines sustains a throughput of
> about 55Mbps. A cycle of file:sendfile() calls sustains over 410Mbps down
> the pipe. Make sure you have a well supported network card before trying.

Great stuff!

Could you please post your benchmark programs too? I'm curious to try
the unoptimised version in Oprofile (best program of the year) and see
what kills the performance - user/kernel copies, context switches,
erlang GC, select(), etc. If I remember correctly, Per Bergqvist was
sending 10Mbps through Erlang on Celerons with only a fraction of the
CPU with the kpoll'ified emulator.

I've long suspected that one could move pretty much the whole network
stack into userspace without much performance loss, if you just chose
the interface well. I'm interested to find out if this is bollocks :-)

P.S., Oprofile is at It is a
whole-system profiler for Linux that will simultaneously profile
*everything* on the whole system, including all applications, kernel
interrupt handlers, etc. Completely amazing.


More information about the erlang-patches mailing list