Sign In Register

How can we help you today?

Start a new topic

NoSQL Collections Performance - Single-big document VS several documents

Hello,


I'm currently creating all my data structures for the game and inserting the Jsons inside run-time and meta collections, and I have a design/performance doubt.


For storing all the PlayerData, would it be a good idea to have several separated runtime-collections for:


- Friends

- Currencies

- UnitsInfo (Unlocked Units, ammount of Units etc.)

- ArenasInfo (Unlocked arenas, matches in each arena etc.)

- Loot Chests Info (current active chests, total opened chests etc.)

- etc.


Or just create a all-in-one JSON with all that information inside it?


What are the trade-offs or differences performance wise? is it hard on GameSpark servers to update a huge JSON file for just changing 1 single field?


In an overly-optimistic scenario, where my game reaches +10k DAU, I woudln't like to crash/slow GS servers because of a bad use, so although both options would work for me, I'm trying to create a good Design since the begining. 


This question is basically for runtime collections, since meta-collections only have the read property, so wether you do several documents vs a big one doesn't really matter performance wise.


Any information about this matter would be appreciated


 Hi Ivan,


Depends how much data you expect to access and return. It is much more efficient to separate your data into collections that make sense. You can always have multiple collections and reference documents using player IDs to access them. It would make sense to have:


-A player inventory collection

-A player achievements collection

-A player friends list


These all serve different purposes and would have a considerable amount of data and different fields.


As long as you have collections that make sense and index the appropriate fields for efficient queries you should be okay.


You'd want to read as little data as possible and return smaller JSON object back to the player.


Cheers,

Omar




1 person likes this

Oki that makes sense and clears my doubts.


Thanks Omar!

Login to post a comment