William Hill kicks off football season with blast from the past
This article appeared originally in ComputerWeekly.
A mathematical programming concept that dates back a decade before the world’s first electronic computer is proving itself in the era of web-scale computing
For the past 70 years, digital computers have followed the principles of a model developed by Jon von Neumann in 1945. The model effectively defines how a stored computer program, comprising a set of instructions, runs. Most of the world’s computers, from the very first – the 1948 Manchester Baby – to the latest generation of mobile devices, x86 desktops and servers, use this model.
Programs, including the operating system, are run as a series of machine instructions, which are fetched and then run one step at a time. It is a model used in computer languages such as C and Java and operating systems such as Unix and Windows.
The von Neumann model has served the industry well – but its limitations are starting to show.
"Twenty years ago, someone did not develop a website to have millions of customers in parallel," says Patrick Di Loreto, betting company William Hill’s research and development engineering lead.
Such procedural code does not cope with parallelism, he says. For example, if a program locks a resource such as a block of memory, that resource cannot be shared by other programs, he explains. Access to the resource is not possible until the lock has been freed.
In the von Neumann model, this lock, known as a semaphore, prevents the memory from being corrupted by being overwritten by another program.
Unfortunately, web-scale businesses need to take an entirely different approach to support the vast levels of concurrency required to support huge numbers of visitors simultaneously accessing their websites.
Di Loreto says: "In 1936, Alonzo Church developed a model of computation called Lambda Calculus, which represents functional programming." It is more mathematical in nature than von Neumann languages such as C, he explains.
Webscale architectures are highly distributed, Di Loreto adds. "Today you have many small machines and your applications are distributed across all of them. We chose to develop software using functional programming because procedural languages are not designed for highly distributed applications."
Read more about functional programming
- Many organisations are hoping that a move to Scala will help them solve some of their most challenging software problems.
The next big thing
Last year, William Hill opened an office in Shoreditch, London, to create a lab for innovation and new products. "Our intention was to encourage teams to develop new applications,” says Di Loreto. "It began with an exercise to understand what enabled innovation seven years ago. We looked retrospectively at innovation – what were the signals seven years ago?"
By looking back at the lessons from the past, William Hill's team wanted to understand what it needed to do to be innovative, he says.
The team did not discover the next device trend, says Di Loreto. Instead, it concluded that data was at the heart of innovation. "It does not matter what will be innovative," he adds. "In order to innovate, we need to control our data."
For instance, the Apple Watch and the IoT (internet of things) will generate a huge amount of data on the net. For Di Loreto, innovation is being able to extract this data quickly enough. "All companies are good at running reports," he says. "This is the second stage of data. What could you do if data was in real time?"
As an example, he says: "If you always log in to William Hill on Wednesday and Saturday and you support Liverpool, I know you will be interested in Liverpool matches. We can use this information to push content on Wednesday and Saturday to make your experience as good as possible."
Using functional programming to innovate
To innovate, William Hill decided to treat data in a modern 'reactive style' and use Lambda Calculus to handle real-time processing, says Di Loreto. "All data sources need to be sent to two layers – a speed layer and batch layer," he explains. "The speed layer is used to calculate 'best bets'. This is sent to the batch layer, which is used to understand long-term business intelligence to create a better profile [of the user]."
The Reactive Manifesto is William Hill's architectural blueprint that describes how it processes real-time data using highly distributed applications. It defines how the system should be designed around scalability, responsiveness and transparency.
The company wanted to emulate the user experience on Twitter and Facebook. "Twitter or Facebook doesn’t require six or seven clicks to get information," says Di Loreto. "We want to make the experience enjoyable."
The Reactive Manifesto came about from the company's work in Shoreditch. In essence, the Reactive Manifesto has been the design principles behind William Hill’s new data platform, called Omnia. "We have a broad number of customers who want fast customer service," says Di Loreto. "This requires a new platform with a data foundation."
A recommendation engine is among the applications William Hill developed on top of the platform. The company created a recommendation engine like those used on NetFlix and Amazon. "But unlike Amazon or NetFlix, where the recommendations last for ever, ours is a five-minute market," says Di Loreto.
“In the next 10 minutes, the product could expire. When someone places a bet, we have a real-time graph so we can see who has placed a bet, and combine this information to present which bets other people have placed.”
William Hill's project began with the adoption of functional programming concepts as the basis for its Omnia platform.
It selected a Java-like programming language called Scala to build the new platform. "After a crash course in Scala, we decided to use it to prototype Omnia," says Di Loreto. "We felt it would let us handle all the data wrangling and logic required to manage the data streams on our users."
He adds: "Scala is mind-changing. It is not a simple language. It offers many different paradigms of programming. You can use object-oriented programming for web services and Soap, interpretative programming and also functional programming."
Omnia was launched on 21 July 2015 in preparation for the start of the football season.