Gaming using Azure Cosmos DB

Azure App Service
Azure Cosmos DB

Solution ideas

This article is a solution idea. If you'd like us to expand the content with more information, such as potential use cases, alternative services, implementation considerations, or pricing guidance, let us know by providing GitHub feedback.

This gaming solution idea elastically scales your database to accommodate unpredictable bursts of traffic and deliver low-latency multi-player experiences on a global scale.

Architecture

Architecture diagram that shows a gaming solution idea that uses Azure Cosmos DB.

Download a Visio file of this architecture.

Dataflow

  1. Azure Traffic Manager routes a user's game traffic to the apps hosted in Azure App Service, Functions, or Containers, and to APIs that are published via Azure API Gateway.
  2. Azure CDN serves static images and game content to the user that are stored in Azure Blob Storage.
  3. Azure Cosmos DB stores user's game state data.
  4. Azure Databricks correlates, cleanses, and transforms game state data.
  5. Azure Functions processes the insights derived from Azure Databricks and pushes notifications to mobile devices, by using Azure Notification Hubs.

Components

This architecture includes the following components:

  • Azure Traffic Manager is a DNS-based load balancer that controls the distribution of user traffic for service endpoints in different Azure regions. During normal operations, it routes requests to the primary region. If that region becomes unavailable, Traffic Manager can fail over to secondary region as needed.

  • Azure API Management provides an API gateway that sits in front of the Gaming APIs. API Management also can be used to implement concerns, such as:

    • Enforcing usage quotas and rate limits
    • Validating OAuth tokens for authentication
    • Enabling cross-origin requests (CORS)
    • Caching responses
    • Monitoring and logging requests
  • Azure App Service hosts API applications allowing autoscale and high availability without having to manage infrastructure.

  • Azure CDN delivers static, cached content from locations close to users to reduce latency.

  • Azure Blob Storage are optimized to store large amounts of unstructured data, such as static gaming media.

  • Azure Cosmos DB is a fully managed NoSQL database service for building and modernizing scalable, high-performance applications.

  • Azure Databricks is an Apache Spark-based analytics platform optimized for the Microsoft Azure cloud services platform.

  • Azure Functions is a serverless compute option that allows applications to run on-demand without having to manage infrastructure.

  • Azure Notification Hubs is a massively scalable push notification engine for quickly sending notifications to variety of mobile devices and platforms.

Scenario details

Potential use cases

This specific scenario is based on a gaming scenario, for the game development industry. The design patterns are relevant for many industries that are required to process high-traffic web calls and API requests, such as e-commerce and retail applications.

Next steps

Review the following articles on Azure Cosmos DB:

Product documentation:

The following solution ideas feature Azure Cosmos DB: