1 / 35

Erlang Open Telecom Platform

Erlang Open Telecom Platform. EAB/UPD/S Ulf Wiger. Contents. Background The Erlang Language OTP The Erlang/OTP Test Server Experiences. History of Erlang. 1998: Open Source Erlang. How to design SW for future telecoms systems?. 1995: Several new projects. 1987: Early Erlang

dillan
Download Presentation

Erlang Open Telecom Platform

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Erlang Open Telecom Platform EAB/UPD/S Ulf Wiger

  2. Contents • Background • The Erlang Language • OTP • The Erlang/OTP Test Server • Experiences

  3. History of Erlang 1998: Open Source Erlang How to design SW for futuretelecoms systems? 1995: Several new projects 1987: Early Erlang Prototype projects 1996: Open Telecom Platform AXD and GPRS started 1984-86: Experiments programming POTS with several languages 1993: Distributed Erlang 1991: First fast implementation

  4. Downloads since Open Source Launch ’98 Grouping: 6 months

  5. Ericsson:AXD 301, GPRS, (NetSim), LCS Nortel: SSL Accelerator, SSL VPN gateway + others TMobile: IN applications Vail Systems: Computer Telephony Apps Service Prov. Erlang Financial Systems: Banking & Lottery systems Mobile Arts: Presence & Messaging for GSM/UMTS Synap.se: Billing & device configuration Blue Position: Bluetooth Location Information System Motivity: Answer Supervision Generator, Signalling Gateway Telia: CTI Platform Corelatus: Signalling gateways & cross-connects Bluetail/TeleNordia: Robust SMTP Mail Server Univ. of Coruña: VoD Cluster Erlang-based Products as of today

  6. Erlang Highlights Functional programming language High abstraction level Pattern matching Concise readable programs • Declarative • Concurrency • Soft real-time • Robustness • Distribution • Hot code loading • External interfaces • Portability

  7. Examples... Erlang Highlights Solid concurrency modelScales to handle complexconcurrencySimple abstractions • Declarative • Concurrency • Soft real-time • Robustness • Distribution • Hot code loading • External interfaces • Portability

  8. activity(Joe,75,1024) Erlang Example Creating a new process using spawn -module(ex3). -export([activity/3]). activity(Name,Pos,Size) -> ………… Pid = spawn(ex3,activity,[Joe,75,1024])

  9. Erlang Example Processes communicate by asynchronous message passing receive {start} -> ……… {stop} -> ……… {data,X,Y} -> ……… end receive {start} -> ……… {stop} -> ……… {data,X,Y} -> ……… end Pid ! {data,12,13}

  10. Erlang Examples 4 Concurrency - Finite State Machine Selective receive ringing_B_side(PidA) -> receive {lim, offhook} -> lim:stop_ringing(), PidA ! {hc, {connect, self()}}, speech(PidA); {hc, {cancel, PidA}} -> cancel(PidA); {lim, {digit, _Digit}} -> ringing_B_side(PidA); {hc, {request_connection, Pid}} -> Pid ! {hc, {reject, self()}}, ringing_B_side(PidA) after 30000 -> cancel(PidA) end. True encapsulationof sub-states Asynchronoussend Optional timeout

  11. Numbers... Erlang Highlights Lightweight processesFast message passingResponse times in the order of milliseconds efficient garbage collection • Declarative • Concurrency • Soft real-time • Robustness • Distribution • Hot code loading • External interfaces • Portability

  12. 1,000 erlang java C# 100 Microseconds/process 10 1 10 100 1,000 10,000 100,000 Number of processes Process creation times (LOG/LOG scale) > 200,000processes Source: Joe Armstrong SICS

  13. 100,000 erlang java 10,000 C# 1,000 Microseconds/message 100 10 1 1 10 100 1,000 10,000 100,000 Number of processes Message passing times (LOG/LOG scale) > 200,000processes Source: Joe Armstrong SICS

  14. Examples... Erlang Highlights Simple and consistent error recovery Supervision hierarchies "Program for the correct case" • Declarative • Concurrency • Soft real-time • Robustness • Distribution • Hot code loading • External interfaces • Portability

  15. Erlang Example Cooperating processes may be linked together using spawn_link(…,…,…) or link(Pid)

  16. Erlang Example When a process terminates, an exit signal is sent to all linked processes … and the termination is propagated

  17. Erlang Example Exit signals can be trapped and received as messages process_flag(trap_exit,true),... receive {‘EXIT’,Pid,...} -> ... end

  18. Erlang Example Robust systems can be built by layering “Supervisors” “Workers”

  19. Error-handling -- Language Safety • No global variables -- fewer side-effects • No direct memory access -- no pointer errors • No malloc/free bugs • Solid concurrency model -- reduces synchronization problems, reduces the state space (simpler programs) • Fault isolation -- memory-protected lightweight processes • Built-in error recovery support -- more consistency Concurrency & Fault Tolerance were designedinto the language from the start!

  20. Debugging and Profiling Support • Symbolic crash reports • Usually sufficient info to locate bugs within minutes • Built-in trace support • Function calls (ability to filter on module name, function and args) • Messages (+ sequence trace) • Process events (context switch, spawn, link, exit) • Garbage collections • Optionally with timestamps (can be used for profiling, benchmarks) • Trace to process, file, or port (network socket) • Also available on live systems

  21. Examples... Erlang Highlights Explicit or transparent distribution Network-aware runtime system • Declarative • Concurrency • Soft real-time • Robustness • Distribution • Hot code loading • External interfaces • Portability

  22. Transparent Distribution A B C B ! Msg C ! Msg Erlang Run-Time System Erlang Run-Time System network Message passing between processes in different computer is just as easy as between processes in the same computer

  23. Simple RPC {rex, Node} ! {self(), {apply, M, F, A}}, receive {rex, Node, What} -> What end {rex, Node} ! {self(), {apply, M, F, A}}, receive {rex, Node, What} -> What end {rex, Node} ! {self(), {apply, M, F, A}}, receive {rex, Node, What} -> What end loop() -> receive {From, {apply, M, F, A}} -> Answer = (catch apply(M, F, A)), From ! {rex, node(), Answer} loop(); _Other -> loop() end. loop() -> receive {From, {apply, M, F, A}} -> Answer = (catch apply(M, F, A)), From ! {rex, node(), Answer} loop(); _Other -> loop() end. loop() -> receive {From, {apply, M, F, A}} -> Answer = (catch apply(M, F, A)), From ! {rex, node(), Answer} loop(); _Other -> loop() end. loop() -> receive {From, {apply, M, F, A}} -> Answer = (catch apply(M, F, A)), From ! {rex, node(), Answer} loop(); _Other -> loop() end.

  24. Examples... Erlang Highlights Easily change code in a running system Enables non-stop operation Simplifies testing • Declarative • Concurrency • Soft real-time • Robustness • Distribution • Hot code loading • External interfaces • Portability

  25. change_code Erlang Example Version 1 Version 2

  26. Examples... Erlang Highlights "Ports" to the outside world behave as Erlang processes(c.f. UML ports) • Declarative • Concurrency • Soft real-time • Robustness • Distribution • Hot code loading • External interfaces • Portability

  27. Erlang Example External process Port Port ! {self(), {command, [1,2,3]}}

  28. A port can use e.g. a TCP, UDP, SSL socket,UNIX pipe, or customtransport (e.g. SAAL) Erlang Example External process Port receive{Port, {data, Info}} ->end

  29. Illustration... Erlang Highlights Erlang runs on any UNIX, Windows, VxWorks, OSE Delta Supports heterogeneous networks • Declarative • Concurrency • Soft real-time • Robustness • Distribution • Hot code loading • External interfaces • Portability

  30. Systems Overview Applications written in Erlang OTP Components Applications written in C, C++ or Java Standard Libraries Erlang Run-Time System Hardware and Operating System

  31. Erlang/OTP (Open Telecom Platform) • Middleware for Erlang development • Designed for fault tolerance and portability • Behaviors: A formalization of design patterns • Components • Error handling, reporting and logging • Mnesia, distributed real-time database management system • CORBA, IDL Compiler, Java & C Interface Support • HTTP Server + Client, FTP Client • SNMP Agent + ASN.1 Compiler • H.248 • XML • ...

  32. OTP Behaviors • "A formalization of design patterns" • A framework + generic code to solve a common problem • Built-in support for debugging and software upgrade • Makes it easier to reason about the behavior of a program • Examples of OTP behaviors • application defines how an application is implemented • supervisor used to write fault-tolerant supervision trees • gen_server for writing client-server applications • gen_event for writing event handlers • gen_fsm for finite state machine programming

  33. Erlang VM Test suite Test server library Adaptation library Erlang rpc, "socket rpc", Corba, ... erl erl erl Corba, SNMP, ... erl Application being tested Application being tested Application being tested Principles of the OTP Test Server

  34. Experiences from Erlang in Large Projects • Easy to build a first runnable application • Easy to debug • Easy to maintain • Very strong support for fault tolerance • Suitable for large systems/projects • Great for prototyping • Impressive performance/scalability in real applications • Outstanding tool for test automation • High programmer satisfaction

  35. Questions?

More Related