Design and Prototypical Implementation of an IRC Chat Server in Erlang OTP

Design and Prototypical Implementation of an IRC Chat Server in Erlang OTP

Authors: Annette Grueber, Tom Jaschinski and Tobias Winkler

Introduction

By the time of this article, digital services provide key functionality to businesses and everyday life. Due to the progress of digitization, the reliance on digital services has been growing rapidly. This process is not only shown by the growing number of inter connected devices that communicate with each other but also by the impact of unavailable services during an incident: On the 4th of October 2021, Meta (former Facebook) and all of its organizations (e.g. Instagram, WhatsApp, Facebook Messenger) were unavailable for up to seven hours. The outage resulted in a huge profit loss for the company and connected businesses. [1]

This outrage shows that modern solutions must be designed resiliently to enable service provisioning during incidents. There are multiple solutions to develop high-available and reliable services that can be applied to various levels in a system’s architecture and design. Some programming languages are specifically designed to meet these challenges. The functional programming language Erlang provides inherent functionality to develop these resilient services.

Therefore, this article presents the exemplary design and development of a communication service based on the Internet Relay Chat (IRC) protocol in Erlang to investigate its availability features.

Background

This chapter deals with the basics of the programming language Erlang. The subchapters give an overview of functional programming and features specific to Erlang.

Functional Programming

Functional programming is a programming paradigm. Various characteristics specify what constitutes functional programming:

  • Pure functions: Pure functions are deterministic functions which always produce the same output value for identical input values. Therefore, it can be concluded that a function cannot be influenced from the outside. Hence, there are no side effects. [2]

  • Immutability: Immutability refers to the fact that data cannot be changed. Once variables have been assigned a value, the variable can no longer be reinitialized. Therefore, reinitialization is only possible by introducing a new variable with the adjusted value. Since classical loops in imperative programming languages require updating variables by e.g. incrementing them, there are no loop statements in functional programming. Iterating over data requires recursive function calls. [2]