Elixir – a tonic for websites that scale?

by Dan King
Posted on 5 October 2016
read time:

Our clients often ask us to build scalable online services that must be fast and responsive, even when used by large numbers of people. For example, the Elefriends peer-support platform we developed for Mind has grown significantly and handles a new message every few seconds.

Earlier this year, we started experimenting with Elixir, a relatively new functional programming language that got our development team quite excited. Since then, we've put our first Elixir-powered site into production, tracking stats for Healthy Island, a health app for children we built with West Wakefield Health. Now we're back from the UK's first Elixir conference in London.

Why Elixir?

At Yoomee, we're always on the lookout for tools and methods that helps us work better. We've had our eye on Elixir for a while, as it can boost the performance of the web apps we build, without sacrificing the kind of productivity we're used to as Ruby developers.

This performance comes from Elixir being built on the Erlang virtual machine, also known as the BEAM, which was originally designed for high volume telecommunications systems. One of the co-creators of Erlang, Robert Virding (pictured below), was at Elixir London to give the keynote talk on the promises and process of moving to languages like Elixir.

Virding talked about how Erlang's background (built in the 1980s for telecoms) has great benefits for use with the web today in distributed, highly concurrent and fault-tolerant systems. He also emphasised the benefit of the ecosystem being multi-lingual, which means Elixir code can easily use libraries from Erlang or any other language on the BEAM.

Best practices

A lot of developers became interested in Elixir last year following Gary Rennie's experiments with the Phoenix web framework. Gary managed to get two million concurrent connections to a single Phoenix app. Our clients don't quite have those connection requirements, but they do sometimes have hundreds or thousands of concurrent users and it quickly gets expensive for sites built on Ruby, which makes Elixir appealing.

Gary is now a core member of the Phoenix team and was at Elixir London to talk about best practices when using the framework. Without getting into too much detail, we think Gary's talk, particularly the details on umbrella projects, really showed how the code is easy to maintain as well as the benefits of well-structured Elixir apps.

Maintaining the code

Perhaps the most relevant talk for us at Yoomee was from Gabriella Chronis and Marni Cohen from Puppet Labs. As part of a four-person development team that builds internal tools, they began moving from Ruby to Elixir last year and had good things to say about how much better it was for maintaining their code. Marni found that Elixir prevented her making certain mistakes that she had made before in Ruby.

Gabriella shared the details of a rewrite in Elixir of their data warehouse system, a change that brought their longest dataset load time down from eight hours to 45 minutes. The Puppet Labs process of learning as a team and pair programming in Elixir got us excited about how we could follow a similar path at Yoomee.

Elixir and hardware

A couple of the more fun talks involved Raspberry Pi and Arduino hardware connecting to a range of sensors.

Tetiana Dushenkivska's talk covered how she used Elixir and a serial interface with specially wired gloves to detect what fingers you used when touch typing. The software was bringing in key presses from Phoenix channels and combining it with data from the gloves to score the user's touch typing.

One final talk was Ju Liu, who was inspired to use Elixir with as many sensors as possible. He was using a kit of sensors and the Nerves project to build a Mission Impossible-style security system.

It was an impressive talk of live coding and hardware hacking. However, the applause may have been skewed, as the audience realised their clapping could drive up the live readings from his microphone and vibration sensors!

A great start

Elixir London was a well-organised day, particularly for a first in what will hopefully become a regular event. It was certainly useful for us to see Elixir in action and start thinking about how we can take what we've learned and apply it to our work back at Yoomee HQ.

You can find links to slides and videos of the talks on the Elixir London website. If you want something more technical than this blog post, we recommend Claudio Ortolina's talk on GenStage to see an exciting new feature that is coming to Elixir soon.

Posted on 5 October 2016 - By Dan King
Share this post
blog comments powered by Disqus