[erlang-questions] IP packet manipulation within Erlang

Ulf Wiger ulf.wiger@REDACTED
Thu Jan 7 12:15:14 CET 2010

Martti Kuparinen wrote:
> Do you guys have any idea how fast this whole thing would be compared to 
> doing same in normal userland C program? Or even compared to doing the 
> manipulation within Linux kernel.

For just header manipulation, you shouldn't pay that
much overhead, but of course there will be extra costs
associated with going into Erlang in the first place.

There is a fairly ambitious reference, in the form of a
complete TCP/IP stack implemented in Erlang.

A high performance Erlang Tcp/Ip stack
(Paris, Gulias, Valderruten),
ACM SIGPLAN Erlang Workshop, Tallinn, 2005

Here are some quotes on performance from the paper:

"To measure throughput a 1GB file was transmitted between
the two machines in both directions, and measured
several times (Fig.5), taking the mean of the measures. As
expected, the larger the Maximum Tranfer Unit (MTU), the
higher the throughput. The total throughput in the best case
is around 150Mbps. As a comparison, Linux TCP/IP stack
in the same situation gave a total throughput of 615 Mbps,
which is around 4 times higher. The costs in copying from
userspace and of the virtual machine explain the difference
in performance. Linux also takes advantage of advanced features
present in the network cards, such as segmentation
offload, checksum computing in the card, or scatter-gather
copies from memory." (p 58)
"Up to 3000 concurrent connections were opened
with a remote machine, but this reduced the throughput.
A similar test was done with Linux, but opening only 500
connections. Linux showed no reduction in throughput with
those connections, but a few connections used all the available
bandwidth while the others did nothing. The Erlang
stack loses throughput but each of the connections gets the
same share of the bandwidth." (p 59)

Ulf W
Ulf Wiger
CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd



Since January 1st 2010 Erlang Training and Consulting Ltd. has become ERLANG SOLUTIONS LTD.


More information about the erlang-questions mailing list