Hey community,
After a day of working on my app, I am getting the infamous Firestore error of "cloud_firestore/resource-exhausted"
.
I never had these in the past and seriously doubt I am hitting that 50k read limit.
My Firestore collections look like this:
- 8 collections with each collection having about 20ish documents inside.
- 3 collections have DocReferences to other collections
I do have a few queries that query 'everything' from 3 of those 8 collections. The remainder are just queries based on unique DocReferences. Those bigger queries are all cached (hoping to reduce the number of additional reads as a user goes back and forth in the app).
It's just me, by myself doing things (every hour or so, I launch an app test where I test a few things). At one point, I had 8 different testers, generating WAY more documents in those collections and I never got this error.
As this is now the 2nd day I am getting this issue, I have set all of those "big" queries to be single queries
. Smaller queries are set to paginate every 25 records.
Here's a view of my consumption (and as you can see, in the last 24 hours, the app 'just' created 46 writes):
In a near identical app (with 8 beta-testers and about 4x more documents), with a similar configuration and build, this is how my usage looked over the last 30 days.
As you can see, this is a world of a difference.
Questions:
* How do you go about figuring about what causes most reads in your app? (so you can make sure it's truly a read issue)
* I read that this error could be due to the emulator running out of memory/cache.
All in all, what do you recommend I try/attempt to ensure this doesn't keep on happening?
UPDATE: Lessons learnt and insights in the comment below. Major lesson: be careful with those 50k reads you get every day. Plan your reads (and scaling-up plans) accordingly.