Product Management

How your business can benefit from using Elixir and Phoenix

Elixir is a functional language with syntax similar to Ruby that runs on the Erlang VM (BEAM). Ruby like syntax helps its code feel familiar and subjectively beautiful. Developers are extremely happy with Elixir, and that’s why they are continuing to adopt it at an alarming rate. There are major companies that take advantage of Elixir features like WhatsApp, Bet365, Goldman Sachs, Moz, Discord, Pinterest and many more. This technology appeals to programmers by helping them do their jobs better, but how do businesses profit from incorporating it into their technology stack?

Speed of development

The combination of new and productive language features, excellent development tooling, awesome documentation with the stability and predictability of proven technology, makes Elixir a unique language. Development teams are required to deliver top-notch features in a fast pace with no compromises, which makes that technology a perfect match. Due to the functional nature of Elixir, a developer can focus on delivering business value in each iteration, not fighting with a structure of code or caring about object lifetime management.

The language makes heavy use of a technique called pattern matching, that prevents value errors, which are much more common than type errors. It also has an innovative and beautiful, in simplicity, pipelining operator, which allows data to flow from one function to the next in a clear and easy to read fashion. What it means is fewer errors in production and more clarity on business logic - much less fragility in your business roadmap.

Phoenix is a web framework that helps developers build web applications efficiently without worrying about implementation details. It’s similar to Ruby on Rails, but solves many bottlenecks of Rails required by modern applications. A developer can easily handle websockets connections for realtime applications, with LiveView, there is no requirement to build up JS applications to push updates to a browser. A great choice for fast moving teams, that care about deliverables.

Scalability

Elixir has its own way of handling concurrency. Every concurrent activity in Elixir is a process. In comparison to system processes, Elixir processes are extremely lightweight in terms of memory and CPU usage. That is the capability of a system to handle a growing number of operations, which makes it a superior choice for high-traffic systems. Elixir makes a perfect usage of system resources and allows to scale down infrastructure.

Bleacher Report is one example of services that leveraged from Elixir being a major part of their technology. They explained that dropping Ruby allowed them to reduce the number of servers from 150 to 5, while handling 8x more traffic. This seems unrealistic, but our experience using Elixir proves that. Let’s calculate what it means for business. 150 AWS t3.large instances mean $8684 of monthly cost versus $289 and much less overhead in infrastructure maintenance. Wow! You can have one extra engineer or two that are way better assets than passive computer instances.

Stability

Nowadays, a business depends heavily on technology. Even 1-minute outage may create a huge loss in finances or damage company image. Elixir is a programming language that runs on the mature and battle-proven Erlang virtual machine. It’s the same technology which handles most of the phone calls in the world with 99.9999999% uptime. That is 32 milliseconds of downtime a year… Have you ever heard about the maintenance window of your phone operator? Not even during the night.

According to Gartner, IT downtime may generate an average cost of $5,600 per minute for a mid-sized company. Due to differences in how business operates, downtime costs can be as much as $140,000 per hour, $300,000 per hour on average, and as much as $540,000 per hour at the higher end. The financial losses vary when you consider your revenue, industry, time of a day, the number of people impacted, the actual duration of the outage, etc. An unplanned outage of critical business applications during peak traffic time will obviously cause more significant damage.

Having Erlang a runtime engine for Elixir is a great choice for mission-critical applications in your company. The way Erlang was architectured allows you to build strategies around outages of your software, something that is almost impossible in other frameworks or languages.

Maintenance costs

According to Gartner’s 2019 Planning Guide for Software Development and UX, organizations waste $300 billion of developer productivity each year, because developers spend too much time on maintenance. So-called “bad code” that requires significant maintenance ends up costing companies $84 billion a year.

Small apps are easy to keep clean and simple, even elegant. What happens after 6 months or a year of development? Is it easy to keep the code well structured, create good abstractions, and manage technical debt? Phoenix Framework motto visible on its webpage is “A productive web framework that does not compromise speed or maintainability.”. Both “speed” and “maintainability” are some of the reasons behind the long-term productivity a developer will find in Phoenix. For a business, it means much fewer annoying bugs in the long run with no compromise to the initial speed of development. We used to receive queries, where at initial steps of development, fast delivery of the product to the market was much more important than quality. There is a common misconception between less tech-savvy founders that you can rewrite the code later on, when the product succeeds and generates traction. There is a great article that covers lessons from 6 rewrites of projects that ended up not very well. Usually, there is no time to rewrite the product later on. Development teams may end up with confusing situations where they are requested to deliver features at the same initial speed, while they need to work on technical debt. With Elixir and Phoenix, development and business teams are on a win-win situation, where we can deliver business value in the long run.

Security

Elixir has countless use cases and it has already become trusted in certain modern banking systems, telecom applications, messaging applications. Everywhere, you are processing lots of data, that has to be traced, monitored, consolidated and verified. Elixir is the best language if you need an application that incorporates top standards of cybersecurity. Functional programming is about making the complex parts of your system explicit and easily testable. As a developer, you can basically test almost every function and be sure they will be no side-effects generated by other parts of the application. Something impossible in object-oriented languages. The unique message passing between processes removes deadlocks and ensures messages are always processed in the order they were received, which removes a big class of issues, that are exceptionally hard to trace. Elixir is immutable by design. Immutability helps make sure data is not altered or lost and, scenarios can be replayed and verified. Elixir is not the only functional language on the market, but it has all the nice features that make functional programming an asset. Taking all those features into consideration, Elixir is one of the best languages to pick for you mission-critical applications.

Summary

Choosing a technology stack for your next feature isn’t an easy task. Elixir and Phoenix is on the way to become mainstream, seeing early adoptions with major players like Pinterest, Discord, and Bleacher Report. Being backed up by well established ErlangVM, coupled with a familiar Ruby-like syntax, it is becoming difficult for app developers to ignore. Taking all productivity gains and savings in short and long term, Elixir and Phoenix is a perfect match for technology stack in an application you are planning to build.

If you struggle with the pace of your product development or are simply curious about how your product would benefit from choosing Elixir and Phoenix - you can reach us here.