2 / 2
May 2024

We are having a 3 node Mongodb replicaset with Mongodb community server edition deployed on UBUNTU.
a. We having a fitness app which pushes about 150-200 parameters to database for each users every 5 minutes. If the user perform fitness exercise for over an hour, the parameters are huge in number. We store parameters as well as the date and time of session.
b. At present, the user base is about 1000 users. We are exploring any references on scaling this mongodb architecture.
c. Not all collections in database are huge. The collection storing the parameters for each fitness session is actually storing millions of records.

Please share any references for below.

a. Can we shard only particular collection inside the database? e.g. “HealthParameters” collection?
b. I was planning to have sharding by the name of parameter or by the name of users, so that all the parameters for a user belongs to one shard.
c. What if I need to download data on across the users. Can we make queries across all the shards, and download data in one query.
d. If we make physical shard inside same node e.g. making multiple collections by first alphabet of the name of person e.g. “HealthParametersA”. What will be the down or concerns in this strategy?
e. What will be the recommended sharding strategy in above scenario of Fitness App where each fitness session, about 150 parameters for each users are stored every 5 minutes?

More details

Fitness App, connected with a breath analyzer which sports people wear while performing fitness sessions.

a. Today, there are about 1000 users, and this will grow to 10000 by end of this year.

b. Each breath data inside the session we send back to database has about 500 odd parameters being calculated and stored.

c. Inside the database, we have a collection storing the parameter records. This collection stores each parameter as separate record. This was done to improve the system indexing of data.

d. Today, we have around 85Mn records in the Parameter collection, for across 500 odd customers using the app everyday.

Using MongoDb Community Server - I need references to any such architectures etc for fitness apps, or showing the sharding of specific collections inside the database.