Blog Technology

Using Elixir For Innovative Digital Veterinary Healthcare

What is Elixir, and why have we chosen to use it on our back-end? Read this techy blog to find out more!

Using Elixir for innovative digital veterinary healthcare

The programming language, Elixir, has become increasingly popular since it was first launched in 2012. Used by companies such as Whatsapp, Bleacher Reports and SquareEnix, Elixir is a dynamic, functional language designed for efficiency and maintainability. Elixir runs on Erlang VM (BEAM), originally designed for telecommunications, making it a highly suitable option for high traffic systems, such as Felcana’s. Compared with other languages, Elixir also boasts API responses of just microseconds to dramatically reduce delays, and with the ability for 2 million active websocket connections on one single server, can also dramatically reduce server numbers and therefore our maintenance requirements by up to 30-fold.

What makes Elixir so good for healthcare?

There are many features that make Elixir on Phoenix a top competitor for other previous popular alternatives such as Ruby on Rails. All Elixir code runs through processes – these lightweight threads of execution are entirely isolated but can communicate through messages. Thousands of processes can run concurrently on one machine, however can also communicate with other processes running on different machines connected to the same network. This vertical and horizontal scaling allows the code to be highly concurrent and distributed to use machine resources as efficiently as possible. Processes are garbage collected independently, reducing system-wide interruptions for users, and the capability for code hot-swapping allows for 0% downtime even when delivering updates to the production system. Elixir is also highly fault tolerant. When it encounters a system failure, programs known as supervisors will restart pre-defined areas of the system and revert them to a known, initial state which is guaranteed to work.

In terms of the language, Elixir allows for code that is much cleaner, concise, fast and maintainable. Pattern matching allows our vast amounts of data to be de-structured in order to access valuable information, and the pipe operator, which passes the value of the previous expression into the next function as the first argument highlights the data being transformed again allowing for much neater code. The capacity to split the code into umbrella projects when used with Phoenix also makes the code much more manageable, and immutability of the code means that the end product is easy to test for faults and read.

Elixir and Felcana

At Felcana we have chosen to use Elixir due it’s low latency, fault tolerant, reliable nature. Our product is constantly collecting data from your pet, and by using Elixir we are ensuring that we are providing a lightweight, highly distributed, maximum efficiency server which can run all day, every day, enabling us to become pioneers in digital pet health monitoring. Clever stuff.