Erlang

Go, Erlang, Elixir; what’s in a programming language anyway?

“The right tool for the job” is a popular adage in the online betting industry, writes Erlang Solutions CEO Stuart Whitfield.

ErlangIn seven years at Erlang, I’ve learned that there are three key reasons why Erlang and Elixir are often the right tool for the job in online gambling and betting: superior concurrency, scalability, and reliability.

bet365 has more than 22m customers, making it the world’s largest online gambling company, with reports suggesting that up to three-quarters of its £1.5bn revenues come from international markets. Extreme scalability, concurrency, and reliability is a must to keep bet365’s engines turning. bet365 lives by the mantra the right tool for the job, and runs a mix of Erlang, Elixir, and Go in production.

So when and where should you choose Erlang, Elixir or Go in your betting stack?

Concurrency

At any one time bet365’s systems are serving many hundreds of thousands of users live odds and results, while managing multiple data streams on the backend. In peak times, like the Super Bowl or the Grand National, the number of users swells by an order of magnitude. This is an awesome feat of concurrent engineering.

When it comes to concurrency, Erlang and Elixir, both built on the BEAM virtual machine, excel. They are both concurrency oriented functional languages, built to handle vast numbers of users at the same time. Users of Erlang across verticals as diverse as telecoms, adtech; financial payments; massive multiplayer online role playing gaming; and social media have all exploited its ability to provide impressive concurrency.

Go also offers good support for concurrency, especially when comparing it to Ruby, Python, or C++. However, is not an alternative to Erlang or Elixir for backends where availability and low latency for high numbers of concurrent requests is required, as in online betting.

Scalability

Modern betting infrastructures demand massive scalability, speed, and fault tolerance to run smoothly. Without scalability built into the system, operators can be left to rely on additional hardware to scale vertically, which is not a sustainable nor a cost effective approach.

Erlang and Elixir’s abilities around concurrency go hand-in-hand with their massive scalability. If Erlang isn’t the best tool for every job your system has, a distributed architecture that can plug into Erlang-based products can make your betting system quick to deploy and scale elastically. Tools built in Erlang, such as Riak KV, scale out, up and down predictably. Say goodbye to the headache of emergency hardware and unpredictable system performance under severe load.

When you pit Go’s requests per seconds against the likes of Ruby on Rails or Django, Go returns some impressive benchmarks performing three times better. Go can scale to hundreds of thousands with relative ease, in much the same way that Erlang and Elixir scale to millions.

Reliability

Like the stock market, downtime for an online betting operator has immediate financial and reputational consequences. For online sports betting the provision of a ultra-reliable, real-time service is now a priority for bookmakers and punters alike. Just look at the booming in play market for sports events.

In this world, pauses of any kinds, for system failure, garbage collection, or queuing backlogs, are not acceptable. Online betting stacks must handle their constant torrents of data without impacting the system’s processes, or end users.

Erlang and Elixir’s concurrency, no-shared memory architecture and built-in ‘fail and recover’ approach make them behave extremely gracefully and predictably under highly variable stochastic load. In fact, Erlang can support data changing at four times other languages’ rate. This makes Erlang and Elixir ideal to build critical gambling and betting systems on.

Go is tooled very well, but some of its automated triggers can cause errors, jeopardising server code that is supposed to reply immediately. This in turn can harm its overall reliability in comparison to Erlang and Elixir.

Join Chandru Mullaparthi, former Head of Software Architecture at bet365 and Chairman of the Erlang Industrial User Group at the London Erlang User Group, where he will draw on his experience to Build the ideal betting stack (Wednesday 11 October, 18:30 BST, Erlang Solutions HQ).

Erlang Solutions

Erlang Solutions specialises in giving business truly scalable solutions through the creation, integration, delivery, and lifetime support of products and services based on the Erlang programming language. Four of the world’s top bookmakers currently look to Erlang Solutions for technical know-how. Learn more about Erlang Solutions’ work in the online gambling & betting industry.