Erlang on Cloud

1-click AWS Deployment    1-click Azure Deployment

Overview

Erlang is a programming language and runtime environment. Erlang has built-in support for concurrency, delivery and responsibility acceptance. Erlang is used in several large telecommunication systems from Ericsson. Erlang is accessible as an open source from http://www.erlang.org.

Erlang is a programming language that was formed at the Ericsson Computer Science Laboratory by Joe Armstrong and his team. It was released under an open source license in 1998. Erlang was originally designed for implementing telecom switching systems, i.e. for building large and complex systems which need to be reliable and to perform in a predictable way .It may be characterized as a concurrent functional programming language that has been used to create soft real-time systems with various amount of code. Erlang comes with the Open Telecom Platform which provides a rich set of libraries supporting the development of distributed, dynamically evolvable applications.

Erlang is also a development environment as a whole. The code is compiled to bytecode and runs inside a virtual machine. So Erlang, much like Java and kids with ADD, can run anywhere. The standard distribution includes (among others) development tools (compiler, debugger, profiler, test framework), the Open Telecom Platform (OTP) Framework, a web server, a parser generator, and the mnesia database, a key-value storage system able to replicate itself on many servers, supporting nested transactions and letting you store any kind of Erlang data.

The VM and the libraries also allow you to update the code of a running system without interrupting any program, distribute your code with ease on many computers and manage errors and faults in a simple but powerful manner

The design goals of Erlang are reflection of its initial application area

  • concurrency – thousands of events, such as phone calls, happen and should be processed simultaneously;
  • robustness – Uptime in telecommunications is a lot more important than domains such as Web/Online services. Thus, an error in one part of the application must be caught and handled so that it does not interrupt other parts of the applications. Preferably, there should be no errors at all.
  • • distribution – the system should be distributed over several computers, either due to the intended features of the application, or for robustness or efficiency.

The following key features of the language follow in the train of the above considerations:

  • functional programming style with strict evaluation, single assignment, and dynamic typing;
  • message passing paradigm for concurrency;
  • error recovery;
  • hot code replacement.

OTP

OTP (Open Telecom Platform) is a large collection of libraries for Erlang to do everything from compiling ASN.1 to providing a WWW server. Most projects using “Erlang” are actually using “Erlang/OTP”, i.e. the language and the libraries. OTP is also open source.

  What sort of applications is Erlang particularly suitable for?

Distributed, reliable, soft real-time concurrent systems.

  • Telecommunication systems, e.g. controlling a switch or converting protocols.
  • Servers for Internet applications, e.g. a mail transfer agent, an IMAP-4 server, an HTTP server or a WAP Stack.
  • Telecommunication applications, e.g. handling mobility in a mobile network or providing unified messaging.
  • Database applications which require soft realtime behaviour.

Erlang is good at solving these sorts of problems because this is the problem domain it was originally designed for. Stating the above in terms of features:

  • Erlang provides a simple and powerful model for error containment and fault tolerance (supervised processes).
  • Concurrency and message passing are a fundamental to the language. Applications written in Erlang are often composed of hundreds or thousands of lightweight processes. Context switching between Erlang processes is typically one or two orders of magnitude cheaper than switching between threads in a C program.
  • Writing applications which are made of parts which execute on different machines (i.e. distributed applications) is easy. Erlang’s distribution mechanisms are transparent: programs need not be aware that they are distributed.
  • The OTP libraries provide support for many common problems in networking and telecommunications systems.
  • The Erlang runtime environment (a virtual machine, much like the Java virtual machine) means that code compiled on one architecture runs anywhere. The runtime system also allows code in a running system to be updated without interrupting the program.

 Erlang is not particularly suitable for?

People use Erlang for all sorts of surprising things, for instance to communicate with X11 at the protocol level, but, there are some common situations where Erlang is not likely to be the language of choice.

The most common class of ‘less suitable’ problems is characterised by performance being a prime requirement and constant-factors having a large effect on performance. Typical examples are image processing, signal processing, sorting large volumes of data and low-level protocol termination.

Another class of problem is characterised by a wide interface to existing C code. A typical example is implementing operating system device drivers.

Large systems developed using Erlang make heavy use of C for low-level code, leaving Erlang to manage the parts which tend to be complex in other languages, like controlling systems spread across several machines and implementing complex protocol logic.

 Who uses Erlang for product development?

The largest user of Erlang is Ericsson. Ericsson use it to write software used in telecommunications systems. Many (dozens) projects have used it, a particularly large one is the extremely scaleable AXD301 ATM switch. AXD301 has several hundred people working on it and the code volume has reached about 850 kloc of Erlang (and 1 Mloc of C/C++).

A few of the other companies using Erlang are

  • 2600Hz(VoIP platform)
  • AdRoll(Real-time bidding, ad serving)
  • Bluetab Solutions(Event data collection)
  • Corelatus(Signalling in telecommunications networks)
  • net (in Latvian)(Web Services)
  • EE (British mobile operator, previously T-Mobile and one2one)(advanced call control services)
  • Facebook(Facebook chat backend)
  • Finnish Meteorological Institute(Data acquisition and real-time monitoring)
  • Gambit Research(High frequency trading in sports betting markets)
  • IDT corp.(Real-time least-cost routing expert systems)
  • (Electronic financial instrument exchange software)
  • Klarna(Electronic payment systems)
  • Lindenbaum(Large scale voice conferencing)
  • Mitel(VoIP Services)
  • Mobilearts(GSM and UMTS services)
  • Netkit Solutions(Network Equipment Monitoring and Operations Support Systems)
  • Process-one(Jabber Messaging)
  • Quviq(Software Test Tool)
  • RabbitMQ(AMQP Enterprise Messaging)
  • RAD(SSL accelerator, previously owned by Nortel, Alteon and Bluetail)
  • Smarkets(Betting exchange and prediction market)
  • Telia(a telecomms operator)
  • Vail Systems(Interactive Voice Response systems)
  • Wavenet(SS7 and IVR applications)
  • Whatsapp(Messaging for smartphones)

Who uses Erlang for research and teaching?

  • Ben-Gurion University(Israel) in the Communication Systems Engineering Department.
  • Chalmers Tekniska Högskola, Gothenburg, Sweden.
  • Costa Rican Institute of Technology.
  • Heriot-Watt Universityin the UK.
  • Iligan Institute of Technology of the Mindanao State Universityin the Philippines.
  • IT University of Gothenburgin Gothenburg, Sweden.
  • KTHin Stockholm.
  • Kurgan State Universityin Russia.
  • The Royal Melbourne Institute of Technologyin Australia.
  • Technion—Israel Institute of Technology (Electrical Engineering Faculty).
  • Technische Universität Kaiserslauternin Germany, for research and in their distributed systems source.
  • Tecnológico de Monterrey, Campus Estado de Méxicoin the Programming Languages course.
  • Tufts University, USA, in the Concurrent Programming
  • University of A Coruñain Spain.
  • The University of Kentin the UK
  • University of Sheffield in the UK
  • University of Sydney, in a distributed stream processing engine.
  • University of Zagreb in Croatia, in the Concurrent Programming course and also for research.
  • Uppsala University in Sweden is home to the HiPE

Erlang is a programming language used to build massively scalable soft real-time systems with requirements on high availability. Some of its uses are in telecoms, banking, e-commerce, computer telephony and instant messaging. Erlang’s runtime system has built-in support for concurrency, distribution and fault tolerance.

The term Erlang is used interchangeably with Erlang/OTP, or OTP, which consists of the Erlang runtime system, a number of ready-to-use components mainly written in Erlang, and a set of design principles for Erlang programs.

The Erlang runtime system is known for its designs that are well suited for systems with the following characteristics:

  • Distributed
  • Fault-tolerant
  • Soft real-time
  • Highly available, non-stop applications
  • Hot swapping, where code can be changed without stopping a system.

FEATURES

Erlang Features:

Few features of Erlang are mentioned below:

 Battle Tested

  • It has been in production applications for more than 30 years
  • Community Support is still getting better
  • It powers most of the robust systems that handles of millions of users
  • It’s in-built libraries are far more self-sufficient to create and deploy applications in an instant
  • 30 years of programming needs and pressure made sure that ERLANG is the base for many other functional programming languages
  • OTP (Open Telecom Platform), a set of standard tools that shows the robustness of Erlang.

Fault-Tolerant

In Erlang, the processes are light weight and are very much similar to OS threads, isolated from each other. So when any process fails, only that process gets affected and the rest of the system stays intact.

Concurrency

All programming languages have some kind of supporting library to support concurrency, but the Erlang has in-built support for Concurrency and since, it’s process threads are really light weight, it can handle more concurrent process with product hardware.

Hot-Code Swapping

The main marketing point of Erlang or less used or underrated feature of Erlang, is it’s ability to upgrade Code without stopping the application. Every other programming languages, need to stop their systems to bring the innovative changes to effect, but erlang does it with affluence without stopping the application There are few more features such as pattern matching, immutability and others, which are used everywhere in Erlang, but let’s get through with our key goal.

Advanced features and functionality:

Concurrent programming

Implementing the ability to execute multiple processes simultaneously within a single program (as opposed to running multiple programs simultaneously) has always required changes to the way people program in traditional functional programming languages. This issue with concurrency (or multi-threading) is ensuring that threads that you want to update the information with only affect the data and information you are processing. For example, you would not want a process that updates a single file to be executed multiple times, because you would risk the file getting corrupted in the process.

Erlang takes the approach that all programs are concurrent, and that components (functions and modules) never share data. Instead, data is exchanged between components using messages. Using messages helps to eliminate the concurrent data modification issue by limiting how individual components can modify data. Instead of changing data directly, a message is sent to update the data, making isolation and concurrent updates more difficult. Erlang also works on the principle that operations will fail and therefore has a system in place to be able to handle errors and if necessary recover from them.

Internally Erlang handles the concurrency issue by creating small lightweight executions called processes. Unlike other major languages such as C, these processes are not built on top of the native operating system processes or even thread model, but are created and managed internally by the Erlang virtual machine. This allows each process to be significantly more lightweight in terms of memory and CPU requirements than a native OS thread. Furthermore, because Erlang operates by creating and using many of these small processes automatically, it is common to run many thousands or even millions of processes, even with a relatively simple program.

The concurrency model is built into Erlang, and therefore the management of such large numbers of processes is a key part of how Erlang works. The messaging system, which is used to send data between processes, is also built-in and designed to distribute messages to any processes very efficiently, regardless of the current number of running processes. As a side benefit of the message implementation, messages can be sent not only internally but also across the network, allowing Erlang to support distributed programming across machines by sharing the messages across multiple instances.

Processes

Because the Erlang process system is so lightweight, the creation of processes is very straightforward and easy, because there is no overhead and therefore little reason to worry about the implications. This means that you can create a new process for any reason to help your application.The actual spawning process itself will never fail, even if the function that you are calling does not exist. This reduces the requirement to test the spawning process in your code. Errors in processes beyond those in the Erlang shell are handled and recorded by the error logger, a built-in process that handles the error reporting.

The built-in messaging system handles this interaction.

Messaging

The messaging system in Erlang is another built-in part of the Erlang execution environment and works in combination with the process system to allow for the efficient exchange of data and messages.Each process is provided with a ‘mailbox’ into which another process can send messages. Messages are stored in the order they are sent, which means that if you send sent two messages, A and then B from one process to another, the messages appears in the mailbox with message A first, and message B second. Because of the concurrent nature of the process system, the ordering of messages from multiple processes to a single one are not ordered in any specific way, beyond the individual order of messages from the same process.

To send a message to a process, you need to know the process ID of the process with which you want to communicate. You then use the construct: Pid ! Message where Pid is the process ID, and Message is any Erlang data type.

To receive a message from within a process, you use the receive statement. Within the receive statement you use pattern matches to determine what to do based on the message content. If the match is successful, the message is received from the mailbox, the message arguments are made available by binding them to the variables in the match, and the corresponding clause is executed. Messaging, especially when combined with concurrent processing, enables programs to process information sequentially, even if there may be multiple requests coming from different locations. This gets by one of the main issues with typical concurrent programming in other languages in that data and operations can be shared without worrying about corrupting or destroying the information in the process. This eliminates one of the main pain points experienced by most concurrent programming problems .Concurrency, however, only gets you so far when it comes to solving the problem of scaling up your solution and improving performance, particularly in modern network and web applications. Eventually you get to the point of requiring more than one server. Fortunately, Erlang has a solution for this distributed programming problem too.

Distributed programming

Distributed programming in Erlang is built on a combination of a simple network server and the messaging system is to provide the mechanisms for sending and receiving messages and, more outstandingly, for supporting the kind of remote procedure call supported by environments such as the native RPC and web services. It’s value noting that distributed does not necessarily mean different machines, it could be two different Erlang applications that want to talk to each other and share information or operations. Erlang makes no difference about the local or remote nature of the systems during all-purpose use, excluding in identifying the systems we are interacting.

 

AWS

Installation Instructions For Ubuntu

Note: How to find PublicDNS in AWS

Step 1) SSH Connection: To connect to the deployed instance, Please follow Instructions to Connect to Ubuntu instance on AWS Cloud

1) Download Putty.

2) Connect to the virtual machine using SSH key Refer this link:

  • Hostname: PublicDNS  / IP of machine
  • Port : 22

Step 2) Other Information:

1.Default ports:

  • Linux Machines:  SSH Port – 22

2. To access Webmin interface for management please follow this link

Configure custom inbound and outbound rules using this link

Azure


Installation Instructions For Ubuntu

Installation Instructions For Ubuntu

Note: How to find PublicDNS in Azure

Step 1) SSH Connection: To connect to the deployed instance, Please follow Instructions to Connect to Ubuntu instance on Azure Cloud

1) Download Putty.

2) Connect to the virtual machine using following SSH credentials:

  • Hostname: PublicDNS  / IP of machine
  • Port : 22

Username: Your chosen username when you created the machine ( For example:  Azureuser)

Password: Your Chosen Password when you created the machine ( How to reset the password if you do not remember)

Step 2) Other Information:

1.Default ports:

  • Linux Machines:  SSH Port – 22

2. To access Webmin interface for management please follow this link

Configure custom inbound and outbound rules using this link

Google

Installation Instructions For Ubuntu

Installation Instructions For Ubuntu

Step 1) SSH Connection: To connect to the deployed instance, Please follow Instructions to Connect to Ubuntu instance on Google Cloud

1) Download Putty.

2) Connect to the virtual machine using SSH key

  • Hostname: PublicDNS  / IP of machine
  • Port : 22

Step 2) Other Information:

1.Default ports:

  • Linux Machines:  SSH Port – 22

2. To access Webmin interface for management please follow this link

 

Video

Ubuntu Installation

Erlang on Cloud