From a web application to a distributed system

Gianluca Padovani 10.05.2018

This article is an introduction to Gianluca Padovani’s talk at Code BEAM STO, on how to develop a web application that can scale to a distributed system.

Why this talk at Code BEAM STO?

Gianluca compares conference presentations to software and bananas, they rot if we do not take care of them. His Stockholm talk will update his Milan talk, as well as the code-base that both of them refer to. Gianluca plans to eventually create a workshop about this topic once complete, that can help new developers familiarise themselves with these concepts.

In the Beginning...

In the beginning, web development was very “simple,” there was a web server, a bunch of scripts and a database. Every single http request was translated into SQL queries that loaded or wrote data in a DB, the result was often the creation of a HTML page and nothing more. If we were in a “complex environment” we had some background tasks powered often by something similar to cron. Our DB was the truth and everything was in a single place, everything had a beginning (the arrival of the http request) and an end (the delivery of the http response).

This procedure developed a development attitude where we created all the related objects (we were probably adopting an OOP language) at the beginning of our work and we destroyed everything at the end. We were “ not allowed” to keep data and object in memory because everything started and finished with the life of the http request.

However, over time, the web became a platform to develop “applications” where the state cannot be kept in a single database and in a single process (you may hear a little voice whispering  “microservices” …). Operations now span the length of a single http request and we now need the ability to communicate with a lot of different systems and keep track of their states.

There is currently a lot of interest in how these problems are solved in the BEAM environment (using Actor model) and how some common patterns like Supervisor or GenServer are used in other languages or frameworks, Akka for example. Gianluca has been developing software since the last millennium and has seen a lot of patterns and development models rise and fall. There’s a saying in Italy “paese che vai usanza che trovi” (when in Rome do as the Romans do) and this holds true with programming too, there are patterns that the newbies need to learn. For those who are coming to the BEAM ecosystem through Elixir they are indeed lucky, because they will find they are able to take advantages of Erlang and the BEAM virtual machine’s patterns, which are already ‘battle hardened’ from over 20 years of development history.

About Gianluca Padovani’s Code BEAM STO talk

How can we create a web application that takes advantage of the characteristics of the BEAM using the resources of a single node and eventually scale this to a multi-node application?

Gianluca Padovani will be giving the talk ‘From a web application to a distributed system’ at Code BEAM STO. In this talk, he will be creating a simple e-commerce system that will expose some classic distributed system problems that will be resolved using patterns from the BEAM.

If you want to have a heads-up before the talk, you can dig into the code that the talk will be  based on, here is the repo and here is the link of the talk that Gianluca did in Milan. You can also follow him on Medium.

Gianluca Padovani

Gianluca Padovani

Elixir Developer, CTO @Coders51