Erlang for Test and Support Engineers

Target Audience: Support and Test Engineers,

Prerequisites:

  • Engineering Degree
  • Basic testing and programming knowledge.

Objectives:

  • Understanding of the basics of Erlang.
  • Reading and correcting Erlang Programs.
  • Writing basic test suites.
  • Understanding of the test and debug strategies needed in finding bugs.
  • Understanding of the debugging primitives so as to be able to implement own tools.
  • Understanding on how OTP is used to structure Erlang based systems.
  • Understand and maintain Mnesia.

Duration: Five days

Erlang/OTP for Test and Support is a hands-on five day introductory course developed for test and support engineers. Its objectives are to give participants the knowledge to read, support, test and debug Erlang/OTP based programs. The course contains all the Erlang basics such as sequential and concurrent programming, along side error handling and the Open Telecom Platform. Testing and debugging tools and constructs are covered in depth, giving participants the knowledge to implement their own tools or use and adapt existing ones. OTP design principles and concepts are introduced, providing the necessary base to understand the structure of Erlang based systems. Two sets of exercises are provided. The first requires basic software experience, and is aimed at engineers developing test suites or trouble shooting the code. The second set of exercises is aimed at engineers supporting and trouble shooting systems, but who are not requiered to do any coding.

Course Contents


Erlang/OTP for Test and Support is a hands-on five day introductory course developed for test and support engineers. Its objectives are to give participants the knowledge to read, support, test and debug Erlang/OTP based programs.

The course contains all the Erlang basics such as sequential and concurrent programming, along side error handling and the Open Telecom Platform. Testing and debugging tools and constructs are covered in depth, giving participants the knowledge to implement their own tools or use and adapt existing ones. OTP design principles and concepts are introduced, providing the necessary base to understand the structure of Erlang based systems. Two sets of exercises are provided. The first requires basic software experience, and is aimed at engineers developing test suites or trouble shooting the code. The second set of exercises is aimed at engineers supporting and trouble shooting systems, but who are not requiered to do any coding.

Course Contents:



Introduction

This section starts off with an introduction of the software needs of telecom control systems, followed by a history of Erlang, its features, and product and research examples within and outside Ericsson.

Basic Erlang

This section deals with Erlang data types and pattern matching. Functions, modules, and BIFs are discussed. Before the exercises, the Erlang shell, useful shell commands as well as Emacs and its Erlang mode are introduced.

Sequential Erlang

The Sequential Erlang section comprehends conditional evaluations, guards and scope of variables. It introduces recursion, with a special emphasis on different recursive patterns, tail recursion, and space saving optimizations. Before the exercises, libraries and their manual pages, possible run time errors and the debugger are demonstrated.

Concurrent Erlang

This section describes the creation of processes and their life span. It looks at sending and receiving messages, selective reception, and passing data in the messages. It continues with the various uses of time outs and registering processes, and terminates by showing the generic process code structure. Before the exercises, a demonstration of the Process Manager tool is given.


Process Error Handling


This section introduces the simple but powerful error handling mechanisms in processes. It looks at process links, exit signals and their propagation semantics. How robust systems are built in Erlang are discussed, and an example from the Process Design Patterns section is re-implemented, making it robust.

Modules and Process Bifs

This section looks at how to retrieve information on processes and modules. The bifs used to retrieve system information can be used to gather information which might give clues in solving a bug or help profile the system. The information includes process states, process heaps (backtraces), call chains as well as memory and processor usage.

Code Updating

Here, we cover software upgrade during run time. The ability to load and replace modules without affecting the state of the processes and the contents of their variables is one of the features in Erlang systems that allows high availability and no down time.

Distributed Programming

An introduction to the requirements of distributed systems is given, and how Erlang is able to fill these requirements. The distribution syntax and semantics are covered, followed by the BIFs and the net kernel.

Crash Dumps

Crash dumps are files generated whenever the Erlang run time systems terminates abnormally. This section describes how these files can be read so as to understand what caused the termination of the virtual machine.

Trace Bifs

Trace bifs provide a low level trace mechanism. The fact that it can be used with out trace compiling the code makes it useful when tracing garbage collecting, memory consumption, message passing, and other process activities including local and global function calls. This section looks at how to activate and deactivate the different trace flags as well as turning them on for different processes, modules and functions.

The dbg Tool

The dbg tool is a text based debugger providing a friendly interface to the trace bifs with small impacts on system performance. This section introduces the tool and covers how this tool can be used in a distributed environment or how the output can be redirected on other nodes, log files, ports and sockets.

Behaviours and Servers

This section introduces the need and advantages of using middleware in the development of massively
concurrent, distributed, fault tolerant real time systems in Erlang. Erlang processes display similar properties.
In the Open Telecom Platforms, these properties have been abstracted in a group of generic library modules,
also called OTP behaviours. This section introduces the concept of behaviours, and through examples of
abstraction, shows their need and advantages. This is extensively exemplified by looking at the generic
server behaviour in OTP.

Supervisors

Supervisors are a behaviour whose only task is to start other Erlang behaviours and monitor them for abnormal termination. This is a vital section in understanding start and restart strategies in Erlang.

Applications

This section introduces the application behaviour, used for packaging Erlang resources. Resources can vary from libraries to process clusters, and can be configured to run on a single processor or be distributed on a set of nodes.

System Arcitecture Support Library

The System Architecture Support Library was used in the first release of OTP to package tools needed for large scale software design. This section covers error logging, the report browser, alarm handler and overload module.

System Principles

The System Principles section describes how Erlang applications are coupled together in a release and started as a whole. Sections include creating release files, bundling up the software including the virtual machine, and running Erlang on target and embedded hosts.

Records and Funs

This section introduces records and funs, two key datatypes needed when using Mnesia.

An Introduction to Mnesia

Mnesia is a distributed, fault tolerant relational database encapsulated in an Erlang application. This section looks at starting and configuring Mnesia, followed by creating, populating and manipulating tables. It introduces transaction handling, locks, and complex queries. It concludes with guidelines on when to use and not to use Mnesia.

Maintaining Mnesia

Mnesia is a complex database, and lots can go wrong. This section introduces basic maintainability issues such as backups, repopulating databases from backups, traversing backup’s offline gathering information. It also covers the largest problem with distributed databases, network partitioning.

Mnemosyne

Mnemosyne is Mnesia’s own query language based on list comprehensions. This section introduces
mnemosyne and the more complex queries that can be achieved using it.

Query List Comprehensions

QLC is a new query language intended to replace Mnemosyne as the Mnesia query language. QLC als
support queries for ETS, DETS tables and other searchable data structures. The concepts and how
construct queries presented.