A global gaming company develops a multiplayer game. Player profile data (username, email, preferences) is stored as simple key-value pairs and must be accessible with single-digit millisecond latency from any region. Game session logs are stored as JSON documents with varying fields (session ID, player actions, timestamps) and must be queryable by player ID and timestamp range using SQL-like syntax. The company wants to use a single Azure database service for both workloads. Which combination of Azure Cosmos DB APIs should they choose?
Trap 1: SQL API for both profiles and logs
While the SQL API can store both, it is not optimized for simple key-value lookups with the same performance as the Table API. Using the SQL API for profiles would still work but would be less efficient and more costly for simple reads.
Trap 2: MongoDB API for profiles and Cassandra API for logs
The MongoDB API is document-based and can handle JSON, but it is not as simple as the Table API for key-value. The Cassandra API is column-family and does not natively support SQL-like querying on JSON documents; it is designed for wide-column workloads.
Trap 3: Table API for both profiles and logs
Using the Table API for both profiles and logs would simplify infrastructure but sacrifices query capability. The Table API is optimized for fast point lookups and simple range scans on a fixed partition key/row key schema, not for ad hoc SQL-style queries over nested JSON properties. Session logs typically need filtering by player ID, timestamp ranges, and possibly aggregation of event attributes; the Table API lacks the indexing and query engine to support these operations efficiently. While player profiles are a perfect fit, forcing logs into the Table API would require service-side denormalization and still fail to meet the analytics requirements.
- A
Table API for profiles and SQL API for logs
The Table API provides key-value storage with single-digit millisecond latencies, ideal for player profiles. The SQL API supports JSON documents and full SQL query syntax, perfect for querying session logs by player ID and timestamp.
- B
SQL API for both profiles and logs
Why wrong: While the SQL API can store both, it is not optimized for simple key-value lookups with the same performance as the Table API. Using the SQL API for profiles would still work but would be less efficient and more costly for simple reads.
- C
MongoDB API for profiles and Cassandra API for logs
Why wrong: The MongoDB API is document-based and can handle JSON, but it is not as simple as the Table API for key-value. The Cassandra API is column-family and does not natively support SQL-like querying on JSON documents; it is designed for wide-column workloads.
- D
Table API for both profiles and logs
Why wrong: Using the Table API for both profiles and logs would simplify infrastructure but sacrifices query capability. The Table API is optimized for fast point lookups and simple range scans on a fixed partition key/row key schema, not for ad hoc SQL-style queries over nested JSON properties. Session logs typically need filtering by player ID, timestamp ranges, and possibly aggregation of event attributes; the Table API lacks the indexing and query engine to support these operations efficiently. While player profiles are a perfect fit, forcing logs into the Table API would require service-side denormalization and still fail to meet the analytics requirements.