Sendfile in erlang
Luke Gorrie
luke@REDACTED
Fri Nov 14 17:14:00 CET 2003
Ulf Wiger <ulf.wiger@REDACTED> writes:
> My wet dream is that one should always start by developing a reference
> implementation of any given protocol in Erlang. Then -- only if performance
> is not good enough -- implement (or buy) one in C. The Erlang-based
> implementation will help you understand the protocol fully, can serve
> as an education and testing tool, and should eventually (this should be
> a goal for the development of Erlang) be the preferred implementation
> to use in your commercial product.
Did this just the other month when building a "distributed ethernet
switch" out of Linux boxes. There's already a switch in Linux
('bridge' module), we just needed the "distributed" part. No worries -
wrote a virtual network device in Erlang with the 'tuntap' application
from Jungerl. To Linux it looks like a network card, but frames
sent/received just go to Erlang - which tunnels them over UDP between
other nodes.
Ultimately we did want more performance - the bottleneck seemed to be
the user/kernel interface. But by then it was all very well
understood, and took one day to port the traffic code into a kernel
module.
Amazing every now and then when things go as they should. :-)
Dream-wise though, I would prefer to use shared-memory between user
and kernel space for packet buffers to avoid the copies and keep the
logic in userspace. Linux seems to already have features in this
direction.
-Luke
More information about the erlang-patches
mailing list