Fantasy sports leagues are really big business. Bengaluru startup HalaPlay serves millions of avid Indian sports fans with a choice of fantasy football (soccer), fantasy cricket and most excitingly, fantasy kabaddi.
If you’re not from the Indian subcontinent, you may not know about kabaddi — a complex, fluid game of tag unlike any other, comprising two teams of seven. Played in India for thousands of years, it’s only recently seen the creation of professional national leagues and major television coverage — and an upsurge in interest that HalaPlay was perfectly positioned to capitalize on. Fantasy players love it: in just two years, HalaPlay has seen its user base grow from 500,000 to 9 million online players.
Growth is good. And spectacular growth is spectacularly good — but only if your app scales with usage so players continue to have a good experience, explains HalaPlay’s former Chief Technical Officer, Shubhanshu Singh.
Ensuring stability and scalability
HalaPlay’s platform is designed to replicate the excitement of a live match. Users create their own teams and compete against teams created by other fans. A leaderboard shows continuously updated scores during the match, and the highest-scoring team can win up to 100,000 rupees (around $1,350, or €1,150). “The real-time experience drives the emotion that sports fans crave,” says Singh.
HalaPlay’s dashboard shows each player’s position within the league, and number of points.
In addition to real-time scoring, HalaPlay uses data analytics and machine learning to help users draft teams, analyze playing behavior, and generally improve their fantasy sports skills. “We make it easy to interact and see results, which drives increased engagement and improves overall viewership,” Singh says.
The platform’s ability to scale would be key to HalaPlay’s success, and drove the founders’ decision to use MongoDB. They knew MongoDB was reliable, and Atlas — MongoDB's cloud database service — offered the necessary scaling and operational support they needed. When HalaPlay decided to also use MongoDB Realm — a set of application development services that speed new feature development — they had peace of mind knowing it could scale with them.
HalaPlay migrated to Atlas as it closed its Series A funding round at the end of 2018. In just over two years, HalaPlay’s user base has grown from 500,000 to nearly 9 million users.
“Using MongoDB in the cloud was a very easy decision, and it’s worked out very well,” says Singh.
As HalaPlay continues to grow, Atlas’s scalability is also well-suited to the seasonality of fantasy sports leagues. Singh explains that HalaPlay scales up the shard during big seasons, and can easily scale down when the season is over and fewer users are on the platform. “With last year’s explosive user growth, we increased the number of shards from two to seven or eight to support the traffic. We split the traffic from one shard to multiple shards, avoiding CPU bottlenecks. It required some architectural changes, but scaling with MongoDB was great,” says Singh. “It just worked.”
Platform built for real-time engagement
For HalaPlay, the decision to use MongoDB Realm was also a driver of their recent success. MongoDB Realm’s services allow their developers to invest more time improving the user experience, rather than developing the backend. “We’re only 20 people, so every ounce of energy has to go into improving the user experience, not building and tending the machinery,” says Singh.
To build and scale the leaderboards that users love, HalaPlay’s team used MongoDB Realm’s event-driven triggers and functions. The leaderboards aggregate user activity across the platform, allowing users to see how many matches they have going, current scores, and how close they are to the top. “It builds a real sense of community. People keep coming back for more,” says Singh.
“When it came to real-time, data-driven events, we had a choice,” says Singh. We could pull all the data into our own servers and do our own processing, or we could use MongoDB Realm’s triggers. They were brand-new, but they were exactly what we needed. Any changes on a collection could be watched directly via MongoDB Realm, and real-time user transactions could then create automatic events. It powers things like the confirmation emails that are sent whenever a user updates their wallet.”
HalaPlay’s developers have also used MongoDB Realm’s functions and triggers to create an aggregation log for every user, with data streamed and consumed with the help of Apache Spark Cluster, and changes synced via Elasticsearch. This aggregation log powers new features, such as users’ ability to see an up-to-date wallet balance in the app. It also allows HalaPlay’s product teams to run analytics, explore potential new features, and enhance user rewards tied to specific behaviors. With MongoDB Realm’s help, HalaPlay is able to invest effort in its highest-impact areas.
‘Why wouldn’t we do it this way?’
MongoDB Realm also allows HalaPlay’s developers to introduce new features immediately, rather than going through the traditional DevOps pipeline, says Singh. “MongoDB Realm is reliable and consistent, and — because we spend all our time on features — the ROI from cost reduction is immediate and significant. Why wouldn’t we do it this way?”
“Atlas and MongoDB Realm have changed the way our developers work. They’re always building for scale, and many of our use cases require real-time features. Providing an excellent user experience and being able to horizontally scale are both key to HalaPlay’s future growth. In the first year alone, MongoDB Realm supported growing our user base to be five times larger.”
In the end, aggregated data is central to the whole business, says Singh. It’s used to monitor the performance and utilization of the platform in real time, simplifies the building of new features, and even informs HalaPlay’s business strategy and marketing campaigns.
“Every part of the company is driven by data,” says Singh. “It’s like playing a match. Whether you win or lose depends on what you do in the moment, taking in the whole picture and moving instantly to take advantage. Atlas and MongoDB Realm give us the information we need to take advantage of an opportunity. The rest is up to us.”