All About Elixir: Create Highly Scalable and Concurrent Web Applications

 

Jason Thane

I’m a software maker by trade and by training, but now I work on strategy, organizational development, supporting company culture, and studying emerging technology in search of the great software platforms of the future.

Updated Dec 13, 2021

What comes to mind when you read the word “elixir?” Perhaps you see images of magical potions that can cure any illness. Or you envision your favorite mixed drink. The Elixir we’re discussing in this article is even more powerful: it can help developers create code that’s bug free, robust, and ideal for highly concurrent applications. Keep reading to learn all about what makes Elixir so useful and how it can help you find the best developer talent for your project.

Overview

In this article we cover the ins and outs of Elixir, starting with a general description and a brief history before launching into the many benefits that come with using this language. You’ll learn about Elixir use cases, including how Discord and Change.org leveraged the unique capabilities of Elixir to great success. Finally, we’ll examine the future of Elixir and how to navigate its use when finding Elixir experts can be challenging.

What is Elixir?

Elixir is as a dynamic and functional programming language best used in situations requiring the ability to handle complexity, scalability, and concurrency. Its strength comes from being built on top of Erlang, well known for running low-latency, distributed, and fault-tolerant systems. However, compared to Erlang, Elixir is generally regarded as much more user friendly and cleaner to work with. To date, Elixir has been successfully used for web development, embedded software, data ingestion, and multimedia processing.

A brief history of Elixir

Elixir was created by a Ruby developer named Jose Valim. The Ruby programming language has long been considered the standard for developing enterprise apps because it is well-built and has a great framework, but it has also been aging. Ruby was built in a time when we didn't have the same internet we have now. Today, applications often run into issues with concurrency and scaling up applications. 

Valim wanted to enable higher extensibility and productivity for use in building large-scale sites and apps. For this, he turned to the older Erlang programming language. Erlang was built as a telecom solution with massive concurrency and the ability to handle millions of phone call connections. Building on top of Erlang and using the good things that came out of Ruby, Valim created Elixir, a high-concurrency, low-latency language. Originally developed in 2011, today Elixir is used by a wide variety of companies, including Discord, Pinterest, Moz, and many more.

Elixir’s many benefits

Elixir comes with a whole multitude of benefits, including the following: 

  • Concurrency: This is probably the biggest one of all. Elixir is lightweight, and being built on top of Erlang makes it possible to create multiple concurrent processes without issue. Two million connections per second is well within its capabilities.
  • Fault-tolerance: The Erlang core also makes Elixir fault-tolerant against both external network problems and internal issues including logic bugs. 
  • Reliability: Elixir has helpful internal tools for building process trees and setting up recovery strategies. Embedded functionality also makes it possible to build self-healing applications.
  • Scalability: Elixir’s built-in scheduler makes it possible to scale vertically by adding more power to a given machine, but the concurrency capabilities also make it possible to scale horizontally by spawning multiple processes in different machines in a cluster.
  • Speed of development: Because the Elixir language is easy and clean, developers can write understandable code quickly. It is also a productive language, meaning that it can accomplish a lot with minimal code.
  • Extensibility: The design of Elixir allows developers to extend the language to their particular domains, further increasing productivity.
  • Tooling: Elixir comes with a variety of development tools, including Mix, a build tool with tasks for creating, compiling, testing, and more, and IEx (Elixir’s interactive shell) which makes auto-complete, debugging, code reloading, and documentation formatting easier.
  • Erlang compatibility: Because Elixir runs on the Erlang VM, Elixir programmers can leverage the Erlang ecosystem and invoke Erlang functions with no run time cost.

Not only is Elixir easy to read and learn, but the Elixir community is hugely supportive and is continually creating libraries and reusable code that's solid, tested, and robust. Elixir’s relative newness also means the libraries are fresher and the environment is cleaner to work in.  

Elixir use cases

Though it was born out of Erlang—the primary application of which is in telecommunications—Elixir has uses spanning a wide variety of websites and applications. For example, building open APIs with Elixir is great. Elixir’s concurrency allows developers to spin up separate GenServers to run separate processes or run a bunch of different applications all at once. A GenServer is a process that can be used to keep state and execute code asynchronously with a standard set of interface functions and error reporting functionality.

Some additional examples of Elixir use include the development of Discord, an instant messaging and distribution platform that relies heavily on scalability and concurrency. Elixir forms the backbone of Discord’s chat infrastructure, providing the technological flexibility needed for growth. Discord’s current Elixir stack contains around 20 different services, each capable of scaling individually to handle large amounts of traffic.

The famous Change.org platform made use of Elixir to develop applications that manage email dispatching, incoming event processing, and analytics in a way that handles spikes and load regulation. Change.org came to this solution after building four different proofs of concept in different programming languages, with each required to process 100k messages as fast as possible. After evaluating each for performance, developer experience, and community support the Elixir solution won out.

The future of Elixir: Advancing the state of the art

At present, Elixir is sometimes overkill when it comes to simpler web app development, but as it matures you can expect increased flexibility. The future is wide open. In fact, some in the Elixir community are steering it toward artificial intelligence and machine-learning applications.

Valim and crew recently developed and released Numerical Elixir (Nx), an open-source library that makes it much easier to start utilizing Elixir in machine learning, data science, and numerical computing applications—avenues historically in the domain of Python and other similar languages.

The Elixir paradox: how it helps you find top talent

While there’s no question that Elixir is powerful and works very well in a variety of settings, it’s also newer than a lot of other languages out there. One challenge faced by those who want to pursue application or web development with Elixir is the relative dearth of programmers skilled in the language.

However, the small number of Elixir experts isn’t necessarily a bad thing when it comes to finding talent. In fact, because Elixir is less common and newer, it has a way of attracting only those programmers who are especially talented and driven to seek out new languages to learn. 

In 2004, programmer Paul Graham described this phenomenon when he wrote an article titled The Python Paradox, stating that, “If a company chooses to write its software in a comparatively esoteric language, they'll be able to hire better programmers, because they'll attract only those who cared enough to learn it.” 

While this applied to Python in 2004, today it applies to Elixir. By choosing Elixir, you’re going to attract only programmers who are passionate about learning the best and most innovative languages. So, while there aren't hordes of Elixir programmers out there ready to be hired, the ones that are will be awesome and level up your development game significantly.  up automatically.

An excellent alchemy

Elixir is an excellent solution for many new applications, especially if concurrency, scalability, and clean code are what you’re looking for. Developers can get a prototype off the ground in just a few days, with a final product ready in weeks instead of months. At GenUI, we’ve used Elixir to great success both for internal projects and to help solve customer challenges. 

If you’re looking for help with Elixir code, GenUI can work with you on everything from planning a successful product strategy to lending the brainpower of our Elixir experts. Contact us today to learn about how it can be part of your recipe for visionary software.