Betfair Bets on Couchbase NoSQL

Betfair, one of the world’s largest international online sports betting providers. Betfairs Exchange processes more than seven million transactions every day, more than all European stock exchanges combined, 99.9% of which are completed in under one second. The Betfair technical team relies on NoSQL technology to power their consumer-facing web and mobile businesses, and Couchbase is the database behind its production systems.

Betfair by the Numbers

As the pioneer for the world’s first online betting exchange, Betfair's website today operates at very large scale, with a website and architecture that must support multiple web and mobile applications, vast numbers of users and a large volume of data and operations. From a business perspective, Betfair’s operations include:

  • 4 million funded user accounts
  • 140 locations worldwide
  • 30,000 bets placed per minute
  • 120,000 requests per second (on the busiest betting day, the Grand National, the requests are in excess of that)
  • 288 million GBP of customer's money on the books at any given time
  • 2.2 billion GBP of mobile business in FY12, representing 111% growth in mobile year on year

From a data perspective, Betfair operates in 30,000 “markets” with large, volatile datasets (because it operates as an exchange, prices are always changing). The data need to be fresh to make sure people get accurate prices. Also, people in different markets are only allowed to see certain events or data, so Betfair needs to e able to shape the to accommodate all the variations. Large volumes of data from sources outside the Betting Exchange must be managed, as well as massive amounts of logging data - about 500 GB a month, not including historical pricing data.

Betfair's Technology Challenge

Betfair needed a data management solutions that fits within its application stack, which is JVM heavy, runs Linux on commodity hardware, and makes heavy use of virtualization in a private cloud. The company uses Oracle to support its transactional systems, but because of the impedance mismatch between Oracle and object-oriented languages, operating at this scale requires serious skills for relational database developers; scaling is not easy and very heavyweight. Where possible, Betfair wished to replace Oracle with NoSQL technology, which matches well with object-oriented languages, is inherently scalable, provides very fast lookups, and integrates very well with Betfair’s Continuous Delivery methodology. The flexibility and scalability of NoSQL promised to reduce a lower time to delivery, which reduces the time between development concept and cash in the door.

Taking the NoSQL Plunge

Betfair decided to focus on a few use cases for it initial use of NoSQL.

  • Web tier persistence (session and cross-section store). Betfair maintains session data for its Betslip (shopping cart for bets), even across sessions (e.g., when the same user accesses the cart on the web or mobile). They had attempted to use Cassandra to support this use case, but it was not a good fit and they wished to explore another NoSQL option.
  • User preferences. Betfair's desire is to shape the interactive experience for the customer on the site in a way that maps to how the user wants to behave, across multiple applications. User preferences were historically tied to customer account when there was a single web channel, but now it's multiple channels with the addition of mobile. Historically, Oracle was used for this use case, but Betfair believed NoSQlo would be a better fit.

Betfair’s Requirements

When evaluating the various NoSQL options, the top priorities for Betfair included:

  • performance - especially deterministic performance on virtual machines
  • strong consistency
  • scaling - both current and future
  • schema flexibility
  • multi-tenancy when required
  • simplicity, which they saw as fundamental to reliability,continuous delivery and deterministic performance
  • enterprise support
  • room for future uses

Betfair Chooses Couchbase as Strategic Document NoSQL Solution

After a thorough evaluation of NoSQL alternatives, the Betfair team chose Couchbase, Looking at the criteria, Betfair found Couchbase mapped well to their requirments:

  • Performance. Couchbase performance was "seriously fast" and highly deterministic in Betfair's real-world testing. They found it was ideal for their architecture (virtualization/private cloud), and far outperformed their existing solution.
  • Scalability. Betfair found that Couchbase was inherently scalable, with an impressive ability to add nodes under load without affecting performance. Replication helps them avoid failure cascades when under load.
  • Schema flexibility. Couchbase's data model gives more power to the developers, giving them bthe ability to work with the entire stack and access data quickly. It also decouples data migration from application development, which is an important requirement for Betfair as they roll out new features. It also enables A/B testing, making it easy to have two different users look at different versions of a web page with different interactive behavior, without having to create dual schemas.
  • Continuous Delivery. Betfair pushes 50-60 builds each day, with two different teams pushing the changes Couchbase makes it very easy to coordinate and merge changes from their worldwide development team becuase there is no rigid schema to contend with.

Couchbase was also stable and resilient, provided greate ease of use for both developers and operators, and delivered excelent enterprise support for the Betfair team.

Couchbase has been in production at Betfair since mid 2012, and is now  their strategic NoSQL solution. Couchbase scalability and performance have been proven at Betfair, even peak betting days, including the Grand National. 

Couchbase is Betfair's strategic document NoSQL solution.

– Martin Anderson, Site Architect

Betfair is one of the world’s largest international online sports betting providers. The company was founded in 1999 and pioneered the first successful Betting Exchange, allowing customers to bet at odds set by themselves or by other customers. Betfair, headquartered in the UK, employs 1500 people and has nearly a million active users worldwide.