March 30, 2015
This is the first post in a series of blog posts, entitled Riak Customer Stories, where we will look at common use cases for Riak and their applicability in specific verticals. Our first customer stories will focus on how Riak is helping Gaming companies achieve massive scalability.
Online gaming continues to grow in popularity, whether for huge gaming communities like Riot Games’ League of Legends or gaming sites like bet365, one of the world’s leading online gambling groups. This growth is forcing changes to existing infrastructure in order to keep up with demand and innovation. Traditional relational databases can’t meet the requirements for massive scalability, speed, and fault tolerance
Innovation is critical to retain long-term customer loyalty and is changing the way gamers play online. These changes include the move away from single bets on an event to in-game betting on an ever-increasing range of metrics. The advent of regional gaming competitions, like the League of Legends World Championship with an annual grand prize of $1 million, show just how far gaming has come.
Gaming on Riak
Companies who build games or betting sites use Riak in three key ways:
- Player Data – Riak provides low-latency, highly available data storage for key player data, including user and profile information, game performance, statistics and rankings, and more. Riak also provides many different tools for querying and indexing this data, such as a full-text search engine and secondary indexing.
- Session Storage – Riak is used to store and serve session data with predictable low-latency, which is necessary for game play. Riak imposes no restrictions on the type of content stored (since all objects are stored on disk as binaries), so session data can be encoded in many ways and can evolve without administrative changes to schemas.
- Global Data Locality – While gaming, players require a low-latency experience, regardless of their physical location. Interrupted or slow game play can lead to poor user experience and player abandonment. Riak Enterprise’s multi-datacenter capabilities allow game data to be physically close to players and for fast response times regardless of player location.
- Social Information – Riak is built for very fast data storage. Due to its inherent design and Riak’s simple key/value data model, Riak is ideal for storing and serving social content such as social graph information, player profiles, player relationships, social authentication accounts, and other types of social gaming data.
By using Riak, companies have achieved global availability, massive scalability, while still maintaining operational simplicity These benefits are derived from the core architectural decisions made in the design of Riak.
By design Riak is masterless. Each node in a Riak cluster is the same, containing a complete and independent copy of the Riak package. There is no “master” or coordinating node. This uniformity provides the basis for Riak’s fault-tolerance and scalability. When this is coupled with an even distribution of data around the cluster via consistent hashing, there is a significant decrease in risky “hot spots” in the database while lowering the operational burden associated with manually sharding data. In addition, new nodes can easily be added with automatic, minimal redistribution of data.
This distribution of data in a masterless system is supplemented with a process of “hinted handoff”. Hinted handoff lets Riak cleanly handle node failure. If a node fails, a neighboring node takes over its storage operations. When the failed node returns, any updates received by the neighboring node are handed back to it. This ensures availability for writes and updates and happens automatically.These are discussed in greater detail in a blog post entitled Why Riak Just Works.
Modeling Gaming Applications in Riak
The table below illustrates key/value mappings for common application types. Remember that values in Riak are opaque and stored on disk as binaries – JSON or XML documents, images, text, etc. Riak has a “schemaless” design. Objects are comprised of key/value pairs, which are stored in flat namespaces called “buckets.” The way data is organized in Riak should take into account the unique needs of the application, including access patterns such as read/write distribution, latency differences between various operations, use of Riak features (including MapReduce, Search, Secondary Indexes), and more.
Here are some common approaches to structuring gaming data with Riak’s key/value design:
|Player Data||Login, email, UUID||Player Attributes (often stored as a JSON document); Player Rewards and Stats|
|Social Data||Login, email, UUID||Player Profiles, Social Graph Information, Facebook/Twitter Tokens|
|Session Information||User/Session ID||Session Data|
|Image or Video Content||Content Name, ID, or Integer||.JPG, .PNG, .GIF or other image format; .MOV, .MPG, .MP4 or other video file format|
Gaming Customer Stories
In a recent webinar, Dan Macklin, Head of Research and Development at bet365, provided an overview of their decision making process in choosing Riak. As one of the world’s leading online gambling groups, with over 18 million customers in two hundred countries, bet365 has a unique perspective on making an informed, strategic decision when designing an always available application architecture.
In this webinar, Dan discussed:
- bet365’s journey to Riak
- The evaluation and technical challenges being addressed
- The triumphs of migrating to Riak
- Advice for anyone evaluating their database requirements
bet365 was faced with a massive scale issue. Their existing SQL, relational database solution was simply unable to keep up with the demand placed on it by their infrastructure without needed to incur the complexity and cost of sharding. The lack of scalability was causing undue stress on their infrastructured leading to a loss of availability. Of particular interest, for those sharing a similar decision making process, is that Dan discusses not only their search for a solution but their decision making process that ultimately identified Riak
The session is available for replay here.
At RICON 2014, Basho’s distributed systems conference for developers, Michal Ptaszek gave a session entitled Let’s Chat About Chat. This session provided detailed insight into how Riot Games built their League of Legends chat system with Riak to handle 70 million players.
In League of Legends, just as in any competitive team game, communication is essential to success. Therefore, when building Chat for the game we had to make sure that the new service would be absolutely rock solid in every respect. This includes not only guaranteed message delivery and consistent presence propagation across the system, but also maintenance of the created social network graph.
In this talk I would like to present how we achieved linear scalability for Chat, improved its overall fault tolerance, and got ready for the new features we wanted to ship. I will also discuss in detail why we migrated our data from MySQL to Riak and how we used CRDTs to deal with conflicting object updates.
As is thematic in gaming use cases, database scalability was a primary consideration and was an architectural consideration from the start. Riot Games started their application modeling with MySQL –a relational database– but hit multiple performance, reliability, and scalability issues. As an example, it simply was not possible to update the database schema fast enough to track changes made in code.
In addition, Riot Games leverages the multi-datacenter capabilities off Riak Enterprise to export persistent data to a secondary Riak cluster. Costly ETL queries, like social graph queries, are run on the secondary cluster without interrupting the primary cluster. This design pattern is often referred to as a “Secondary Analytics Cluster”.
Some statistics that highlight the immense scale that Riot deals with:
- 67 million unique players every month (not counting other services using chat)
- 27 million daily players
- 7.5 million concurrent players
- 1 billion events routed per server, per day, only using 20-30 percent of available CPU and RAM
- 11K messages per second
- A few hundred chat servers are deployed around the world. Managed by 3 people
- 99% uptime
To learn more about Riak in the Gaming and Gambling industry, there are several useful resources to begin your research and design your deployment.
- Riak Solution for Gaming – This Solution Brief discusses using Riak for a variety of gaming and gambling use cases.
- Riak Tech Talk – Our experienced team can help develop your use case, answer questions, and make sure you are successful at every step from development to production. We can arrange either in-person or virtual meetings, depending on availability and location.
- Why bet365 chose Riak – Get a better understanding of how to make informed strategic decisions directly from someone who has taken the journey. Dan Macklin, Head of Research and Development at bet365 will show you how. His story about choosing Riak will captivate anyone that needs to ensure their data is always available.
April 16, 2014
The world of gaming can be unpredictable. It can be hard to judge if a game is going to be the next Angry Birds and experience exponential, global growth. Riak is designed to help gaming platforms handle this uncertainty with ease. Its focus on high availability means that all data remains accessibility, even during node failure. Its flexible data model and redundant, fault-tolerant design easily allows gaming platforms to store any type of data needed. Riak is also built for operational simplicity at scale, so Riak will seamlessly grow with data and popularity. Finally, the option for multi-datacenter replication means that gamers all over the world will get the same low-latency experience across multiple devices.
Top Use Cases for Riak in Gaming
- Player Data: Riak provides low-latency, highly available data storage for key player data, including user and profile information, game performance, statistics and rankings, and more. Riak also provides many different tools for querying and indexing this data, such as Riak Search, Secondary Indexing, and MapReduce.
- Session Storage: Riak is frequently used to store and serve session data with predictable low-latency – necessary for game play. Riak imposes no restrictions on the type of content stored (since all objects are stored on disk as binaries), so session data can be encoded in many ways and can evolve without administrative changes to schemas.
- Social Information: Riak provides flexible, robust storage for social data such as social graph information, player profiles and relationships, and social authentication tokens.
- Global Data Locality: When gaming, players require a low-latency experience, regardless of where they’re physically located. Otherwise, interrupted or slow game play can lead to poor user experience and possible user abandonment. Riak Enterprise’s multi-datacenter capabilities allow game data to be physically close to players and serve them data no matter where they happen to be.
Riak in Production
Riak is already in production by many top gaming platforms. Here’s a look at a few that have switched to Riak.
Rovio is the creator of the popular mobile game, Angry Birds. Since user growth can be hard to predict, they needed an infrastructure that could support unexpected viral growth without failing or causing downtime. They selected Riak due to its ease-of-scale and fault tolerance. Riak now powers their new cartoon series, Angry Birds Toons, and new mobile games. Learn more about why they moved to Riak in this case study and video from GDC.
Hibernum is a creator and developer of unique gaming experiences that combine the latest in social gaming, top quality visuals and animations, and cutting edge design. They switched from a relational database to Riak due to the high availability, ability to scale to peak loads, and predictable operational cost. Riak is used to store user game information for one of their most popular social games. Check out the complete case study, Hibernum Selects Riak for User Data Storage.
Kiip is a platform for building rewards and achievements into your games. Kiip replaced MongoDB with Riak in order to achieve low read/write latencies and horizontal scalability. Kiip uses Riak for storing and serving session and device data. Learn more from the video on scaling Riak to 25MM Ops/Day.
Riot Games is the creator of League of Legends and faced some challenges with supporting millions of concurrent players at any given moment. They switched to Riak from MySQL for their next generation stats system, which tracks gameplay statistics and stores terabytes of data that gets aggregated and presented to players in near real-time. More information on how they use Riak and why they selected it can be found here.
Data Modeling in Riak
Riak has a “schemaless” design. Objects are comprised of key/value pairs, which are stored in flat namespaces called buckets. Here are some common approaches to structuring gaming data with Riak’s key/value design:
|Player Data||Login, Email, UUID||Player Attributes (often stored as a JSON document); Player Rewards and Stats|
|Social Data||Login, Email, UUID||Player Profiles, Social Graph Information, Facebook/Twitter Tokens|
|Session Information||User/Session ID||Session Data|
|Image or Video Content||Content Name, ID or Integer||.JPG .PNG, .GIF or other image format; .MOV, .MPG, .MP4 or other video file format|
To learn more about how gaming platforms can use Riak for their data needs, check out the complete overview, “Gaming on Riak: A Technical Introduction.” To get started with Riak, Contact Us or download it now.
March 17, 2014
This week is the Game Developers Conference (GDC) in San Francisco. GDC is the largest, professionals-only game industry events and brings together programmers, artists, producers, game designers, audio professionals, business decision-makers, and more to exchange ideas and shape the future of the industry. Basho is a proud sponsor of GDC and this is our second year speaking and exhibiting at the event.
On Thursday, March 20th, join us for the session, “Riak for Games,” presented by Quark Games and Basho. The talk will be about database choices, mistakes, successes, and lessons learned by the presenters: Eric Liaw and Seth Thomas. Eric, Co-Founder at Quark Games, will give insight from five years of mobile game development. Seth, Technical Evangelist at Basho Technologies, will give insight from his time at Vigil and SOE, as well as success stories from current Riak customers. Their talk will be at 11:30am in Room 3020, West Hall.
In addition to this session, Basho will also be exhibiting. Be sure and stop by our booth to talk Riak and pick up some great swag.
Riak is an ideal solution for many gaming use cases, including storing session data, player stats, and user profile information. For more information on how companies like Rovio, Riot Games, Hibernum, and Mochi Media use Riak, check out our Riak Users Page. To learn more about why Riak is a fit for gaming, download our whitepaper, “Riak on Gaming.”
December 16, 2013
At Strange Loop 2013, Garrett Eardley (Software Engineer at Riot Games) presented “Tracking Millions of Ganks in Near Real Time.” His talk focused on the popular game, League of Legends, and the challenges that come with supporting millions of concurrent players at any given moment of the day. At this scale, tracking even simple gameplay statistics results in the creation of terabytes of data that must be aggregated and presented to players in near real-time. Garrett and his team found that scaling the system and developing additional features became difficult while using Riot’s initial technology choice for statistics, MySQL.
They found that they weren’t using many of the features available with MySQL and began to evaluate some NoSQL solutions. They looked at HBase, Cassandra, CouchDB, and Riak. With this new system, they wanted high availability over consistency, which narrowed the options down to Riak and Cassandra. Based on negative past experiences and a lack of conflict resolution control, the team ultimately decided on Riak over Cassandra.
Garrett’s talk explores how Riak is leveraged for their next generation stats system, discusses why they selected Riak, looks at how they structure their data and indexes, and shares strategies for working with eventually consistent data. The complete recording of Garrett’s talk is now available. You can check out the talk and his slides here.
For more information on how Riak is being used for gaming services and applications, download the Gaming on Riak whitepaper.
September 19, 2013
Strange Loop 2013 is currently taking over St. Louis, MO through September 20th. Strange Loop is a multi-disciplinary conference that brings together developers and thinkers to discuss technologies around emerging languages, concurrent and distributed systems, mobile development, and the web. Basho is a proud sponsor and many members of our team will be there to discuss Riak CS, our open source cloud storage software.
Garrett Eardley, Software Engineer at Riot Games, will also be presenting on how Riot Games is leveraging Riak for their next generation stats system. His talk, “Tracking Millions of Ganks in Near Real Time,” will discuss why they chose to use Riak (and move from their existing MySQL architecture), how they structure their data model and indexes, and their strategies for working with eventually consistent data. His talk will take place today, September 19th, at 9:50am.
Stop by the Basho table to grab some swag and to learn more about distributed systems.