When starting banana, we had to decide which tool we would use to build our backend system. We had experience in many different languages and frameworks such as Ruby on Rails, Node.js, Go, Python, and Java, but we decided to try Elixir and the Phoenix framework.

When comparing, people often use benchmarks for speed, agility, language features, etc. to decide. However, Elixir, more specifically the Erlang Virtual Machine, offered something unique that won us over. Sure, we can talk about how it’s extremely fast, highly concurrent, has immutable data structures, and is a functional language. These are all big wins for us, but we were sold on Supervision Trees.

High Availability

Erlang was engineered to handle the needs of telecom systems to be highly available. All features of the language were designed with availability in mind. For example, having many (in the order of thousands, if not millions) concurrent isolated processes helps keep crashes isolated to as few processes as possible while the rest of the system keeps running. Functional programming, with its idea to decouple state from functions, allows for hot code swapping.

The concept of Supervisors is the secret sauce in my opinion. It treats crashes as first class and allows you to easily describe how to handle crashes and restart from a clean state. Crashes are inevitable. Languages like Haskell promise formal verification to reduce or even eliminate run time errors, but what happens with hardware failure? There is only so much you can protect against. Erlang, on the other hand, acknowledges that crashes will happen and even advocates to let it crash rather than defensive programming. This leads to much clearer code since most of your code is just the happy path.

Business Advantage

As a startup, we didn’t have to worry about scalability for banana just yet (Elixir does very well here too). Our main concern when trying to build our passive income streams is how hands off can we be once this was deployed.

With the help of Supervision Trees, our app knows exactly how to handle crashes. Heisenbugs, which are notoriously hard to track and can sometimes bring the servers down, are no longer a concern. Our app is automatically restarted and we can sleep in peace. Our Pager Duty app has been silent since launching banana :)

To learn more, I highly recommend reading the post The Zen of Erlang by Fred Hebert.

Potato Labs

We create software solutions for companies looking to move fast, iterate, and solve real world problems. If this sounds like you, get in touch with us at hello@taterlabs.com or visit us at taterlabs.com