MongoDB Atlas Serverless Database | Serverless Instance Costs | RPU cost explanation

1.4k Views Asked by At

Can someone explain how RPUs are getting calculated by an example ?

Let's say I have a mongo collection that has 5 million documents. So if i do a findOne to the collection, the RPUs generated would be 5M or 1 ?

1

There are 1 best solutions below

4
On BEST ANSWER

It depends on a crucially import step that I could not find anywhere in Mongo's pricing information.

I had 4000 daily visits with a user database of 25,000 users. I was using findOne on the database two times per page load. What I thought would be 8000 RPUs turned out to be 170 million RPUs. That's right - 42,500 RPUs per page visit.

So the critically important step is: add indexes for the keys you're matching on.

Yes this is an obvious step to optimize performance, but also easy to overlook the first go-around of creating a database.

I was in the MongoDD dashboard daily to check user stats and was never alerted to any abnormalities. Searching online for over an hour, I could not find any mention of this from Mongo. But when I reached out to support, this is the first thing they pointed out. So they know it's an issue. They know it's a gotcha. They know how simple it'd be to point out that a single call is resulting in 40,000 RPUs. Doesn't seem that they care. Rather it seems to be a sleezy business model they've intentionally adopted.

So if you do a findOne on a 5 million document database, will you get 1 RPU charged or 5 Million RPUs charged? Depends if you remembered to index.