Michael Lubas, 2023-08-28
The Elixir programming language is well known in the world of software where uptime is critical to business success. The official description states, “Elixir is a dynamic, functional language for building scalable and maintainable applications.” This is a humble summary of the enormous power Elixir contains, which has saved businesses millions of dollars per year across industries.
The book “Adopting Elixir, From Concept to Production (2018)“ by Ben Marx, José Valim, Bruce Tate is an excellent guide to the strategic and technical reasons to use Elixir in your business. The very first chapter clearly illustrates the benefits.
Pinterest used Elixir for focused, high-volume, high-impact service around performance tooling and monitoring. Steve Cohen is a software engineer who’s been working with their early adoption teams:
José: Why did you choose Elixir?
Steve: We chose Elixir because we were looking for a system that was easy for programmers to understand and could take better advantage of our servers. I was intrigued at Elixir’s combination of friendly syntax, powerful metaprogramming features, and incorporation of the Actor model.
José: How has your company benefited from Elixir?
Steve: That’s pretty easy. When I started on the spam team, we had close to 1,400 servers running. When we converted several parts to Elixir, we reduced that by around 95%. One of the systems that ran on 200 Python servers now runs on four Elixir servers (it can actually run on two servers, but we felt that four provided more fault tolerance). The combined effect of better architecture and Elixir saved Pinterest over $2 million per year in server costs. In addition, the performance and reliability of the systems went up despite running on drastically less hardware. When our notifications system was running on Java, it was on 30 c32.xl instances. When we switched over to Elixir, we could run on 15. Despite running on less hardware, the response times dropped significantly, as did errors.
A language that enables companies to save money while improving reliability and performance seems like fantasy. Elixir is able to demonstrate this incredible result because the language is built on top of Erlang, a platform designed for concurrent software that must stay online. Banking portals, e-commerce sites, and SaaS products are just a few examples, most business software today has this requirement. The story of Elixir improving a product while reducing costs repeats itself.
@coryodaniel
Rewrote an #AWS APIGateway & #lambda service that was costing us about $16000 / month in #elixir. Its running in 3 nodes that cost us about $150 / month.
12 million requests / hour with sub-second latency, ~300GB of throughput / day.
Cory O’Daniel noticed this benefit in 2018, releasing a detailed technical blog post based on the enormous interest his tweet generated. The above example is not surprising to anyone who has worked on a complicated serverless system. The hosting costs quickly become unreasonable, and it may not be possible to run the code locally on your machine when making a change, adding days of expensive development time. Developers love Elixir for the excellent experience it provides when creating software, and the business loves how much more work gets done ahead of schedule.
Bleacher Report, a top real time sports and media website, was hitting scaling problems due to their business success. With Elixir, they were able to 8x the average daily traffic load, going from 150 servers to only 5:
The site was originally written on the Ruby on Rails framework but Bleacher Report reached the point where they could no longer scale it, according to Dave Marks, BR’s senior engineering director.
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,” he said.
“On our monolith we needed roughly 150 servers to power the more intensive portions of BR. Following our move to Elixir we’re now able to power those same functions on five servers and we’re probably overprovisioned. We could probably get away with it on two,” Marks says.
Let’s do a Fermi estimate where each server costs $17,000/year.
One server: | $17,000/year (example) |
150 servers: | $2,550,000/year |
5 servers: | $85,000/year |
Savings: | $2,465,000/year |
30x cost savings, | final bill reduced by 97% |
The final result was a 97% reduction in the server bill, with improved reliability and performance. All this is possible because Elixir, and the Erlang platform underneath, are fundamentally designed for always-online software with many users. When you use the right tool for the job, the benefits are clear.
Paraxial.io stops data breaches by helping developers ship secure applications. Get a demo or start for free.
Subscribe to stay up to date on new posts.