By using AWS re:Post, you agree to the Terms of Use
/Which Database service would be best for this use case?/

Which Database service would be best for this use case?


I'm working on an online turn-based strategy game called CivPlanet. There will be dozens of CivPlanet games running at once, each with its own unique gameID. The gamestate consists of several uniquely named JSON objects, henceforth called CivPlanet objects. Players interact with the server via REST requests, which are sent somewhat infrequently. When the player plays the game, they're probably sending around 1 request per minute.

In short, I need a database service to store all CivPlanet objects. Each CivPlanet object has a timestamp, gameID, and a name to distinguish it from other objects in that game. CivPlanet objects are never created or deleted once the game is added to the database. However, some can be modified. Also, not all games will share the same set of objects.

I need to be able to:

  • Retrieve a list of all CivPlanet games, along with some metadata about each game such as whether it is accepting new players.
  • Conditionally retrieve all CivPlanet objects associated with a given gameID that were updated after a given timestamp.
  • Lock all CivPlanet objects under a given gameID as I prepare to update the gamestate.
  • Atomically overwrite certain CivPlanet objects that share a gameID.
  • Release the lock.

The server receives a mixture of queries and events from the player. When responding to a query, the server needs to check for any updated data on the database, then process the query and return the result. When responding to the event, it needs to obtain a lock, check for updated data, and process the event. If the event fails, it releases the lock and notifies the player. If it succeeds, it publishes the new data to the database and releases the lock, then notifies the player.

My question is, what database service is best suited for these requirements, and what structure should I use within that service? I was looking at DynamoDB. I thought gameID could be the partition key. I'm not sure if I need a sort key, or what that sort key would be.

I probably need two databases, one that maps from gameID to metadata, and another that maps from gameID+objectName to JSON.

Any thoughts?

  • I think it might be interesting if you rewrote the question without mentioning locks. What are your actual serialization needs? Why are you sure locks is how to achieve them? Do you need database-level locks or just an attribute marking something as locked? How will you handle clients that crash after getting the lock? Also it's unclear with the query what it means exactly for the client to "check for updated data"? Does that just mean it should always query against the latest data? Are you anticipating client-side caching or something?

asked 2 months ago27 views
1 Answers

Hi DrCorchit,

I believe you need a database that will be suitable all the following mentioned in your used case. Please note that they are multiple AWS databases that are compatible for your used case, I will recommend you test the debases out on your environment. I conducted some research and the most compatible for gaming were DynamoDB [1] Aurora [2], there is also a documentation on how some customers make use of DocumentDB [3]. I advise you go through the documentation provided about the databases and reach out to solutions architecture for the design of your case.

Refer to these references




answered 18 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions