Table of Contents
What is Elixir? It is a functional and dynamic programming language first released in 2012, so it’s still relatively new.
Since then, it’s been gaining popularity because it’s highly scalable, reliable, and great for microservices and cloud computing. Let’s look at a handful of major-league companies that decided to introduce Elixir into their architecture and see what they gained from the change.
Elixir is based on Erlang VM, a 20-year-old virtual machine built to support robust, concurrent, and distributed software. With its Phoenix framework, Elixir is used in virtually any industry and for any application. Recently, it’s been gaining popularity as an enterprise-level software in:
- telecoms
- banking
- ecommerce
- advertising
- instant messaging
- IoT
The language is perfect for projects that need to support concurrency and low latency, handle a lot of traffic, and scale easily. Actually, in the foreword to “Programming Elixir ≥ 1.6: Functional |> Concurrent |> Pragmatic |> Fun”, a recent book by Dave Thomas, the creator of the language, José Valim, describes concurrency as the backbone of Elixir, adding that its biggest value is “freeing programmers from antiquated concurrency mechanisms.”
The benefits of Elixir also include high fault tolerance, reliability, and a tidy, modern syntax. It’s proven itself useful for distributed systems like Blockchain projects, embedded systems, as well as real-time apps using instant messaging, video chats, or financial apps.
Furthermore, there are multiple additional architectures, services, and frameworks that build upon Elixir. Some examples include:
- Phoenix—a framework for creating REST APIs and HTML applications with Elixir
- Ecto—a database wrapper and query language for Elixir
- ExUnit—Elixir's built-in unit testing frameworks
- Mox—a mocking library for use in automated tests
- Exq—a job-processing library for Elixir.
Thinking of making the switch yourself? Take a look at just a few of the most prominent examples of highly successful companies that have employed Elixir in their major projects in recent months—and the results they managed to achieve with it.
1. Pinterest: Half the Servers, 10 Times Less Code
According to the company's own data, Pinterest had 463 million monthly active users in April 2023, which makes it one of the biggest online businesses that use Elixir. In fact, its speedy growth might have had something to do with its conversion to Elixir in 2014.
The new programming language helped the company to speed up the performance of its notification system delivering 14,000 notifications per second and cut down the number of servers by half—from 30 to just 15—compared to when the service relied on Java.
Using Elixir also allowed Pinterest to clean up its code, slimming it down to around 1,000 lines—a tenfold reduction. Pinterest now also uses Elixir to route more than 30,000 events per second to its in-house rule engine for spam prevention.
Side note: To accelerate business growth and smooth user experience, Pinterest bet on PWA.
Read about details:
13 Best Progressive Web App (PWA) Examples in 2023
2. Moz: 63 Times Less Disk Space, 20 times Faster API
In 2016, Moz Pro, the leading SEO tool and online platform helping companies analyze and improve their search engine performance, overhauled of their backend architecture. Their goals were to:
- improve speed and performance,
- help scale the tool,
- add new features, like selectable date ranges, complete campaign history, flexible in-app data segmentation, and customizable data filtering.
They explained the process and the results on their developer blog. The main problem they had to solve was the fact that the company had outgrown its database infrastructure. As a result, the architecture didn’t scale well and stopped performing properly when flooded with large sets of data, which was absolutely key for a growing SEO analytics tool.
The architecture limited the depth and flexibility of the data to be presented in various ways. The problems they identified included non-scalability, non-standard use of MySQL, and concurrency limitations in Ruby.
Switching to Elixir, they were able to use smaller data files and, as a result, use 63 times less disk space, on average, than when using MySQL rankings tables. They were also able to improve the speed of their API by 20 times compared to the previous API, with average response times consistently below 50 ms (compared to 800+ ms). All in all, the simple deployment resulted in 30 times faster build speeds.
3. Lonely Planet: Better Performance, Scalable Content
Lonely Planet is a worldwide travel site (and a traditional travel guide publisher) serving millions of unique visitors each month. It publishes a lot of rich content using its website, mobile app, and third-party services. The problem was that their web content was stuck behind Ruby on Rails applications, WordPress instances, and various other data stores.
What they needed was to be able to serve it to web and mobile apps quicker and at scale. This called for a different data model, a cleaner API, and a much more scalable infrastructure.
After several failed attempts, the company hired a development team that created several microservices, some of them written in Elixir. One was an Elixir microserver with an API sub-service using the Phoenix Web framework, designed to serve available lodgings from booking.com and HostelWorld. Another microservice written in Elixir serves their inventory of books and ebooks from a custom eCommerce system backed by a Microsoft SQL server.
According to the architects of the new solution, they were able to put a robust architecture in place using Elixir, with much higher performance and lower memory requirements.
4. Financial Times: Easy to Learn, Quick to Scale
The Financial Times is a respected news publication established in 1888. Alongside their traditional daily newspaper, they also run a huge online service that just announced a million paying readers last April. They previously used microservice REST APIs, but to deal with the growing online readership and improve the performance of the service, they turned to a GrapQL API based on Elixir.
Now, they also have another Elixir-based app and enjoy much smaller memory usage compared to Java. According to the now former senior software developer at Financial Times, Ellis Pritchard, Elixir was easy to learn for the development team—another advantage of the language.
5. Toyota Connected: Mobility at a Global Scale
Toyota has just launched its first global car-sharing platform. The service uses Toyota’s proprietary global Mobility Service Platform (MSPF) and a consumer-facing app.
Toyota Connected uses Elixir as part of the backend system that makes up the Mobility Service Platform. It provides an API for mobile and web applications and handles the geo-processing, e.g., verifying whether a vehicle is inside or outside a geofence.
The company’s plans are to have the majority of its new vehicles sold in North America and Japan, sending information to their cloud by 2020. They’re planning to analyze traffic patterns and driver behavior, connect drivers with infrastructure, and create new services and products.
To learn more about how Toyota Connected uses Elixir, watch the talk their developer Powell Kinney gave at the Code Elixir LDN conference in 2018, where he explains designing for longevity using Elixir and Erlang/OTP:
6. Bleacher Report: 8 Times More Traffic
Bleacher Report, a division of Turner Sports, is the second-largest sports website in the world. They get up to 1.5 billion page views a month and send out more than 3 billion push notifications.
Ruby on Rails was originally used to create the service, but the growing traffic eventually demonstrated that the service was no longer scalable. Another huge challenge involved supporting concurrent streaming in their Team Stream app. Given the real-time, mobile-first approach the company boasts, they needed to be able to handle huge spikes in traffic at peak times on mobile devices.
Their development team tried out various options, including Node.js and Go, before finally deciding on Elixir—it brought significant improvements in performance, while its syntax was similar to Ruby’s, which made it easy to learn.
This is how lead engineer Ben Marx summarized the benefits of the switch back then:
Elixir has proven so efficient that testing the limits of our services became a challenge unto itself, requiring investment in new benchmarking tools and strategies. In a recent test, for example, our most heavily trafficked service was able to handle 8x our average traffic load, without autoscaling, before the database proved to be a bottleneck.
Other benefits of employing Elixir included:
- a cleaner code,
- smaller technical debt,
- an increase in development speed,
- impressive performance improvements.
7. Discord: 11 Million Concurrent Users
Discord is a powerful audio/video communication tool that started out as a chat platform for gamers because it seamlessly handles audio input on thousands of voice communication channels at once. Right now, it has gone beyond serving the gaming community and became a communication and collaboration tool of choice for many companies and organizations.
Source: Discord
Discord has an estimated 196.2 million monthly active users in 2023, a 31.5 million or 19.12% growth over the anticipated amount of users in 2022. The company uses Elixir to build and extend its services, in 2019, Discord used Rust to solve the problem of immutable data structures in Elixir. They've posted the solution on GitHub.
8. PepsiCo: Elixir-Based eCommerce Branch Earning 2 Billion Dollars
The company that needs no introduction, PepsiCo, reported using Elixir for their Ecommerce tool for selling consumer packaged goods.In 2019, the branch earned PepsiCo 2 billion dollars.
Jason Fertel, who runs the marketing automation tool at PepsiCo Ecommerce, shared the reasons for using Elixir in Devchat.tv podcast.
He explained that: "Elixir is powerful, straightforward, and easy to learn. It is efficient and has everything you need out of the box."
What Does It Mean for Business?
In most of the cases mentioned above, the switch to Elixir (or the decision to build in Elixir right from the start) resulted in apps and services capable of handling much bigger traffic. That means they scale well and can grow without losing reliability, all the while improving overall performance. In business terms, that means more users, customers, and a higher ROI.