Erlang/OTP and SDL

Matthias 3000a <>
Thu Sep 16 10:59:59 CEST 2004

Eranga writes:

 > Could you kindly give us some benchmark about the performance of
 > your Erlang MTP2 implementation compared to your C or Hardware
 > implementation?

The _key_ part of my comment was that taking a state machine specified
by an SDL diagram and turning it into Erlang code was very easy. You
end up with code which can easily be verified to implement the spec,
the whole spec and nothing but the spec. That is a valuable property.

But both you and Inswitch seized on an _aside_ about performance. The
performance of that MTP-2 implementation tells you NOTHING AT ALL
about the likely performance of MTP-3 or higher SS7 layers implemented
in Erlang. Why?

  1. The main performance-eating parts of MTP-2 are completely absent
  from the higher SS7 layers. You don't have to do bit-stuffing. You
  don't have to deal with floods of five-octet signal units. You don't
  have to compute CRCs on all those five-octet SUs.

  2. That MTP-2 implementation was written with one goal: correctness.
  Performance did not figure at all. On a 166MHz 6x86 (my desktop
  PC at the time), it couldn't even keep up with one 64kbit/s timeslot.
  But I made no attempt to write the code to perform well.

Here's an example of obviously inefficient code, it's the bit-unstuffer:

  unstuff([0,1,1,1, 1,1,1,0|T]) ->
      {Unstuffed, Leftover} = unstuff(T),
      {[flag|Unstuffed], Leftover};
  unstuff([1,1,1,1, 1,1,1|T]) ->
      {Unstuffed, Leftover} = unstuff(T),
      {[abort|Unstuffed], Leftover};
  unstuff([1,1,1,1,1,0|T]) ->  % zero removal
      {Unstuffed, Leftover} = unstuff(T),
      {[1,1,1,1,1|Unstuffed], Leftover};
  unstuff([Bit,A,B,C,D,E,F,G|T]) ->  % have enough lookahead to not be boundary
      {Unstuffed, Leftover} = unstuff([A,B,C,D,E,F,G|T]),
      {[Bit|Unstuffed], Leftover};
  unstuff(Other) ->
      {[], Other}.

This is a poster example of something that is easy, almost trivial, in

 > I am planning to implement a GSM/UMTS MAP service provider layer in Erlang
 > and develop the telecom platform on top of that. Do you think that's wise or
 > just stick to plain old C/C++? Or (slow as hell) Java?

I can't comment on your specific application, but I would expect
implementing the higher layers of SS7 (i.e. MTP-3 and upwards) in
Erlang would be quick to do and give reasonably good performance. The
bit syntax is well suited to the manipulations you need to do on MTP-3
PDUs, which is not so surprising when you consider the bit syntax's

The nasty parts of MTP-2 are not present higher in the stack.


More information about the erlang-questions mailing list