Sign In Register

How can we help you today?

Start a new topic
Answered

How does MongoDB scale?

Hi, 


What is the style of scaling for MongoDB in a production environment?


Are there read slaves?


More questions to follow based on answers. Thanks!


Best Answer

Hi Christopher,


Our MongoDB deployments are 3-node replica sets. By default, we direct all Cloud Code reads and writes to the primary node in order to avoid any issues with delayed consistency when reading. Any reads performed through the NoSQL explorer in our Portal or via our Management REST API are directed to the secondary nodes to avoid any queries causing service issues.

 

We have considered adding API calls to allow slaves to be made from reads, so we would be interested in your use case and whether you think such functionality would be beneficial.

 

Are you able to share any estimates of the amount of traffic you would be expecting to send to MongoDB ?


Thanks,

Liam



Answer

Hi Christopher,


Our MongoDB deployments are 3-node replica sets. By default, we direct all Cloud Code reads and writes to the primary node in order to avoid any issues with delayed consistency when reading. Any reads performed through the NoSQL explorer in our Portal or via our Management REST API are directed to the secondary nodes to avoid any queries causing service issues.

 

We have considered adding API calls to allow slaves to be made from reads, so we would be interested in your use case and whether you think such functionality would be beneficial.

 

Are you able to share any estimates of the amount of traffic you would be expecting to send to MongoDB ?


Thanks,

Liam


Hi Liam,


We're investigating a world map game mode ala Game of War / Clash of Clans etc.


As the player pans the camera around, they would need new map information. This would be the use case for the read slaves. Consistency isn't a requirement here.


For reads; we did some basic "if this then this" numbers. Here's what we came up with:

  • 10,000 bases (players)
  • Hex per base; 27 hexesr = 3.5; hex = 3r^2 - 3r + 1 (includes padding between bases);
  • 270,000 hexes required
  • 70,000 - 120,000 with data
  • 100 bytes for data hex = 12 MB per map
  • Unknown how many maps we will need, depends on # of players

  • Visible map: 25 x 28 = 700 hexes. 25 with info
  • Cache border map: 85,600 hexes
  • 200 with data
  • 100 bytes for data hex = 20 kb sent to client on login
  • 20 kb per 2 'visible map' distance camera pan

Please note that we would prefer to have all this data in generic collections. Even if we partition maps, it is beneficial to have a mapID on the collection instead of new collections per map. This will require very complex, and possibly multiple indexes.

For writes, we expect normal 1 to 1 traffic.

I should also mention that this will game mode makes heavy use of the scheduler.  Every player action will result in an event in the scheduler. What is the scheduler using for a DB, how does it scale?

Did I respond to this? It seems to have eaten my reply.

Hi Christopher 


Apologies your reply got sent to are needs  moderator approval list.

I approved your reply and I'm looking into it now.


Thanks

Katie 

Hey Christopher,

I need a bit more information before i can confidently advise you on this.
But if i understand your requirements correctly, you would like to know about two things...

[1] - if it is suitable to have docs with up to 12Mb of map data to read from.
[2] - if it is suitable for the 20kb of visible map info to be sent back to the client for updating the map
(if i am misunderstanding these two issues, please let me know)

So to address these requirements...
[1] - There is a hard-limit of 16Mb per doc for mongoDB, but the limit to the total DB size is very large, in the order of TB, so the number of maps @  12Mb per map is fine.
There is a mongoDB doc on this you might find interesting [https://docs.mongodb.com/manual/reference/limits/]

[2] - 20kb is fine for responses, the only problem that might occur is in how frequently you need to request that data. If you could provide an estimate i can advise further.
We also have a doc on our own limits you might be interested in looking at, which covers these limitations [https://docs.gamesparks.com/documentation/key-concepts/system-limits.html]

Regarding use of the scheduler, we would need more details about the estimated number of concurrent users and how many actions are requested from the server per minute.

If you think it would be quicker to setup a call and go through these, or any other questions you have we can do that too.

Thanks,
Sean


 

Login to post a comment