Programming languages for online betting: an investigation of Go, Erlang, and Elixir

“The right tool for the job” is a popular adage in the online betting industry. In my time at Erlang Solutions, 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.

Online betting is a booming industry, both in terms of technology and revenue. Case in point; bet365, the world’s leading bookmaker has more than 22m customers, takes 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 100,000s of users live odds and results, while managing multiple backend data streams. 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 built-in scalability, 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 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 at peak load.

When you pit Go’s requests per seconds against the likes of Ruby on Rails or Django, Go returns some impressive benchmarks performing 3x 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 inplay market for sports events.

In this world, pauses of any kind, 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 no-shared memory approach allows processes to terminate without corrupting the state of other requests being executed in parallel. This allows a ‘fail and recover’ architecture where failure is isolated and does not affect the system. As a result, Erlang and Elixir achieve “five nines” availability at a fraction of the effort of other programming languages. 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.

Learn more about our work with our Online Betting partners, such as bet365 and William Hill.

Keep reading

5 Erlang and Elixir use cases in FinTech

5 Erlang and Elixir use cases in FinTech

Erlang and Elixir can be found powering some of the most performative and innovative systems in the world of financial services.

Guess Less with Erlang Doctor
Guess Less with Erlang Doctor

Guess Less with Erlang Doctor

Introducing Erlang Doctor: Leveraging the tracing capabilities of BEAM languages like Erlang and Elixir.

gen_statem Unveiled
gen_statem

gen_statem Unveiled

In this post by Nelson Vides, explore the practical applications of Erlang's gen_statem behaviour, as discussed in his recent FOSDEM conference talk.