Erlang and Erlang/OTP Overview
Last revised May 9, 2000
Erlang/OTP is a middleware for efficient development of competitive high availability systems. It is written mainly in the Erlang language and is used in Ericsson products such as AXD301, DWOS, A910 and ANx. Erlang/OTP is available for Solaris, Linux, Windows 9x/NT and VxWorks.
Erlang was created by the Computer Science Laboratory at Ellemtel (nowadays Ericsson Utvecklings AB) and has now been around for more than ten years. It originates from an attempt to find the most suitable programming language for telecom applications. Examples of characteristics for such an application are:
- Concurrency - Several (thousands! of) things, say phone calls, happening simultaneosly.
- Robustness - An error occuring in one part of the application must be caught and handled in such a way that it does not interrupt other parts of the applications. And preferably, no errors at all should occur!
- Distribution - The system must be distributed over several computers, either due to the inherent distribution of the application, or for robustness or efficiency reasons.
Although most of the investigated languages had many suitable features, they all also had their drawbacks. The idea behind Erlang was to combine the good features of these languages into one language. Erlang has a process concept for supporting massive concurrency. Each process has its own memory, which grows and shrinks dynamically. Communication with other processes is achieved by sending and receiving messages. A built-in error detection mechanism makes it possible to catch errors within and between processes and to restart faulty parts of a program. It is also possible to update code for a running process. Erlang programs can be run on a single node or distributed over several nodes. Process communication and error detection have the same properties wheather distributed or not.
Like Java, Erlang code is compiled into a byte code that is interpreted by a virtual machine. This makes the Erlang code platform-independent. Only the run-time system must be ported for the program to run on another kind of host. It also makes it possible to run different parts of a distributed system on completely different kinds of hardware.
An important difference between Java and Erlang, however, is that Erlang is a functional, high-level language. The Erlang language features and characteristics, and the virtual machine concept makes it useful for complex control system with soft real-time constraints, which is exactly what it was designed for.
Openness is Critical
A programming language is not enough however. Short time to market and openness to sourced hardware and software are critical aspects in today's product development. Therefore, in 1996, OTP was created.
OTP stands for Open Telecom Platform, but is more accurately a middleware aimed at efficient development of competitive telecom applications. OTP consists of an Erlang run-time system, a number of ready-to-use components, and a set of design principles for Erlang programs. Since Erlang is the basis of OTP, the term Erlang/OTP is normally used instead of just OTP.
OTP can be said to be open in three different ways: to different hardware/operating systems due to the platform independence, to programs written in other languages due to the built-in interoperability mechanisms, and to different protocols due to components providing support for HTTP, SNMP, IIOP, FTP, TCP/IP and more.
Help With Design
When developing a product by using Erlang/OTP, the idea is to view the system as a number of services. Examples of services could be a database for storing telephone numbers or handling of call control signalling.
The OTP design principles give a standard way to implement each such service as a self-contained so called application. The system is then put together by chosing the OTP components needed and adding the user-defined applications.
Applications share a common management interface that makes it possible to generate scripts for system start-up and run-time code replacement. Normally, each application is a tree-like process hierarchy with a pre-defined error detection scheme. The processes are implemented using behaviours, which are formalizations of design patterns with built-in support for error handling, tracing and code replacement.
Examples of important components are:
· Mnesia - a distributed database management system, appropriate for telecommunications applications and other Erlang applications that require continuous operation and exhibit soft real-time properties.
· Orber - an Erlang implementation of a CORBA object request broker.
· SNMP - a bilingual SNMP-extensible agent, featuring a MIB compiler and facilities for implementing SNMP MIBs.
There are also components for interfacing and communication, including an IDL compiler, low-level C and Java interfaces and a web server.