AWS for Games Blog
Stateful or Stateless? Choose the right approach for each of your game services
Your game service has many different jobs—from leaderboards, authentication, and game logic servers to matchmaking and more—and you need to choose the right technology for each one. Some services need a persistent connect, but many can use REST APIs. These two approaches are called stateful and stateless, which is often referred to as RESTful. With RESTful services, the player’s mobile device, tablet, PC, or console makes requests to your servers for data such as login, sessions, friends, leaderboards, and trophies. It doesn’t maintain long-lived connections to the server, so these services can be on-demand instead of persistent demand. However, for multiplayer features, it’s important to keep that connection to the server through a stateful approach.
Figure 1: A production-ready game backend on AWS
For example, imagine an open world or MMO game. Some of the functionality, such as running around the world and interacting with other players, requires long-running game server processes. The rest of the API operations, however—such as listing friends, altering inventory, updating stats, and finding games to play—can easily be mapped to a REST web API. Ensuring as much of your game as possible uses RESTful services makes it easier to scale horizontally by adding more server instances.
We’ve created this guide to provide direction on what aspects of your game’s architecture can use REST APIs and which need a persistent connection. This can help you scale your game servers more effectively to meet player demands as successfully as studios like Gearbox Software and Behaviour Interactive.