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?

gefragt vor 2 Jahren277 Aufrufe
1 Antwort

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

[1] https://aws.amazon.com/blogs/database/level-up-your-games-with-amazon-aurora/

[2] https://aws.amazon.com/dynamodb/gaming/

[3] https://aws.amazon.com/documentdb/customers/

beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen