Jos de Jong
Jos de Jong

Reputation: 6819

How is the data size of a MongoDB Atlas cluster calculated: document size or storage size?

MongoDB Atlas hosts MongoDB in the cloud, and has various sizes that you can select, like 2GB, 5GB, 10GB, etc.

It's not clear to me which data size is applicable: in my case I have a database with a document size of 1.6 GB, and a storage size of about 0.5 GB (since the documents are zipped when stored).

Are the size limits of MongoDB Atlas referring to the document size of your database or the storage size?

Upvotes: 5

Views: 6620

Answers (3)

ovolko
ovolko

Reputation: 2807

According to the documentation,

Atlas calculates the storage limit for shared clusters based on data usage, as opposed to the storageSize metric used by non-shared clusters (which includes compression). Atlas determines data usage by summing a cluster’s dataSize and indexSize.

https://docs.atlas.mongodb.com/faq/#how-does-atlas-calculate-storage-limits-for-shared-clusters-m0-m2-m5

Upvotes: 2

Dushyant Bangal
Dushyant Bangal

Reputation: 6403

The cluster disk space used is the fsUsedSize from db.stats()

It is not dataSize (as specified in the selected answer). However, its not exactly storageSize either.

My cluster has around 5GB of dataSize and the fsUsedSize is around 4GB while the storageSize is around 3GB. The ATLAS portal shows 4GB used.

Even in your normal standalone deployment, if you check the directory where the data files are stored, it will be considerably bigger than the storageSize but it will be also considerably less that the dataSize.
You will notice the mongo data directory's size is same as the fsUsedSize.

So, my calculated guess would be storageSize + some overhead (which can be in GBs).

In a nutshell, whatever the mongo data directory on your own deployment will consume.

Upvotes: 1

Jos de Jong
Jos de Jong

Reputation: 6819

I found out the hard way that the size limit is the document size (uncompressed size), not the size on disk.

So for a database with 1.6 GB document size and 0.5 GB disk size, I need a 2 GB plan on MongoDB Atlas.

Upvotes: 2

Related Questions