Adopting Elixir at FindHotel

Introducing new technologies into the tech stack of a fast growing company is not a trivial decision. We always need to be mindful to separate technologies that are simply “cool” from those that create real business value, keeping into account business risks.

On the other hand, as the company grows and the product roadmap becomes more ambitious, the technologies that support the business requirements should follow the same pace of reliability.

At FindHotel we build highly performant, scalable services and components that power our product and provide our users with the best content and deals the accommodation industry has to offer. Scalability, reliability, and great performance are the core of what we build. We currently work with modern stacks such as Go, Node.js, Python, and Scala.

And now Elixir, a dynamic functional programming language designed for building scalable and maintainable applications, is the “new kid on the block” in Findhotel's tech stack.

But why Elixir?

Short answer: “Same or higher productivity and friendliness of Ruby combined with the production-ready reliability of Erlang”

Ruby is the first choice of many startups to build web applications with great quality in a short period of time. Ruby focuses on simplicity and productivity, providing an ecosystem with a long list of tools to help fast development. At FindHotel was not different and we succeeded using Ruby for many years. However, currently our products require a higher standard of performance and scalability, that goes beyond Ruby performance limitations.

Elixir is a dynamic and functional programming language designed to build scalable and maintainable applications, that brings several good parts and mindsets from Ruby, such as friendly syntax, building tools, test-driven development and coding standards.

Even though being relatively young (created in 2011), Elixir leverages the three-decades-old, battle tested Erlang Virtual Machine (BEAM), known for running low-latency systems, with built-in support for concurrency, distribution and fault tolerance, also being successfully used in web development.

The language goals are productivity, maintainability, and reliability.

Among others, the Elixir characteristics are scalability, fault-tolerance, language features like immutability and pattern matching, compatibility with Erlang VM and OTP, a rich ecosystem, and powerful frameworks and libraries available. I could write an entire blog post only describing the main characteristics of Elixir (and I think I will soon 😉).

Steps for adoption

The adoption process was smooth and gradual. Approximately a little more than two years ago, we made the first experimentation in a Ship it Day, our internal hackaton where members of different teams collaborate on experimental projects. At that opportunity an HTTP API for a geolocation service was built using Elixir and Phoenix. The seed was planted.

Some months later in another Ship it Day a prototype for an A/B test mechanism decision was the candidate for one more Elixir application, this time consuming a database using Ecto. In that opportunity we counted on the participation of more engineers interested in Elixir, who had fun applying and learning a new technology.

Later again, a proof of concept project to aggregate value to an application running on production was a good fit for applying Elixir. That time the team created a background job processor managing a workflow and consuming a queue. That PoC ran for about six weeks receiving traffic from the B side of an A/B test.

In the middle of 2018, the micro-service for geolocation was promoted and then finally we had our first Elixir application effectively running on production.

The experience writing code, using the tooling system, deploying and maintaining small Elixir applications has brought confidence to the engineer team takes a step forward.

"Working with Elixir and the functional programming paradigm is refreshing and exciting. As a developer, I felt challenged working out of my comfort zone and the patterns I was used to with object-oriented languages, but also empowered with new tools to make the code more stable and faster."

Antonio Lorusso, Senior Software Engineer

The current challenge

The opportunity to use Elixir again appeared when the company decided to invest in their own checkout solution for FindHotel offers, receiving payments from ours customers and integrating with many different providers and partners. A new squad was formed to create a product from scratch, where the BoFH API (Book on FindHotel API) was the core component.

The main architectural requirement for BoFH API was extensibility, with the goal of integrating different providers with low effort, without changing the public API interface, being able to abstract any provider integration particularities, such as authentication process, data transforming, booking intermediate steps, so on. The extensibility and reliability of Elixir fitted the technical requirements for this new application.

Besides productivity and great performance, the engineer team expected a lower number of infrastructure resources would be needed. Savings on infrastructure was also a big win.

In three months of development, the BoFH squad launched a MVP version of the checkout product integrated with one provider. Later, a second provider was integrated using the extensibility capabilities.

Since the first version was launched, the new checkout solution for FindHotel offers helped our customers with more than 100.000 bookings.

Lighting talk presentation at ElixirConf EU 2019

Conclusion

At FindHotel we have engineers with many years of experience developing in Ruby. Those skills and expertise were naturally put in use when developing our Elixir applications, making the transition totally smooth.

Breaking the paradigm of object-oriented programming to think in a functional way to write code was not painful. At the end, we identified in the code base of our non-Elixir applications some parts already using functional approach in many situations. The acquisition of new programming skills helped to keep up the motivation in our team too.

In addition, I would say the transition was also fun, consequently improving the productivity even more.

The future of FindHotel promises to be shining, and now with an essence of Elixir.

By the way...

... if you want to contribute for FindHotel's checkout becomes the best checkout solution in market, and at the same time have fun writing Elixir code, we are hiring:

  • Elixir engineers
  • Erlang engineers
  • Experienced Ruby engineers motivated to switch to Elixir
  • Engineers coming from any other functional programming languages

You can apply here.