mtamc / memo

Website for rating books, movies, video games, and TV shows.
0 stars 0 forks source link

Fauna free plan limit reached for this month #42

Closed ghost closed 5 months ago

ghost commented 2 years ago

I temporarily upgraded to the Individual ($25/month) plan and put my card on it, here's the breakdown:

Points to expressly consider

dustinvtran commented 2 years ago

4m3 read ops

?

107k write ops ($0.12 over 50k)

Is this because of db maintenance scripts being run a lot? I'm surprised a single user + testing would get us that high.

ghost commented 2 years ago

4m3 = 4,300,000 (4 million 3, might be French notation, sorry) Actually, that was the number for the "Last 7 days". Today it's 3,614,600.

Roughly, 1 doc = at least 1 read op, but it can be multiple read ops as 1 read op = up to 4KB. 1 write op = 1KB written.

Is this because of db maintenance scripts being run a lot? I'm surprised a single user + testing would get us that high.

107k write ops = roughly 107MB written. The JSONs of your 4 lists including reviews total 4.35MB. This checks out. (Overwriting the documents in full 20 times. Can be avoided in future by removing props that haven't changed from our update payloads.)

3,614,600 read ops means up to 14GB read. But a 4.1KB document counds as 2 read ops so it's difficult to estimate. Let's assume 10GB for now. That means accessing your profile 9195 times. That still seems a little overestimated. I'm going to add logging for how many ops are counted per query: https://forums.fauna.com/t/view-costs-with-faunadb-js/483/2

Also, once I add lazy-loading of the reviews, the read ops will probably cut by 10.

ghost commented 2 years ago

8c1b100 Updated db maintenance scripts and documentation to reflect recommending using partial updates

@dustinvtran I checked with fauna support, and if we get back to free plan level usages, we can go back to free plan then...50k write ops seems possible, however, i'm not sure it's possible to get under 100k monthly read ops even while very few people are using the site (i'll try my best, we'll see what happens when I lazy load review and add logging to sniff out any other cause). But are you ok with subbing to the $25/mo plan (no risk of going over, for a very long time), or do you prefer to move to a different cheaper or self hosted solution?

dustinvtran commented 2 years ago

Hmm $25/mo. is a lot what would effectively be a personal website. I'm OK with paying it for a few months but the free limit seems very restrictive unless we're just doing a lot of wasted ops.

ghost commented 2 years ago

@dustinvtran so I'll be lazily loading reviews first for good practice anyway but in the event that it isn't sufficient, we can to move to running the DB on a small server such as a $5/mo droplet. I'd use Prisma instead which is an ORM which generates typings (I made a mistake to reach for Fauna first thing for the serverless convenience without realising how limiting the free tier is, as it's closed source so it can't be self hosted...)

ghost commented 2 years ago

Here are the current stats: profile page with stats refresh: 3068 read ops profile page with no stats refresh: 56 read ops (statse are cached for 48 hours) loading video game: 1620 read ops loading film list: 2585 read ops

Monthly free quota: 100k read ops

That means loading your film list 38 times in a month. That seems a little tight...

ghost commented 2 years ago

I've asked Fauna support if an individually tailored plan could be possible. (Half the price for half the quota)

ghost commented 2 years ago

I've asked Fauna support if an individually tailored plan could be possible. (Half the price for half the quota)

Not possible :sweat_smile: We'll monitor usage, I'll think about strategies to cut down, and if not possible I'll switch to a droplet-hosted database or something.

dustinvtran commented 2 years ago

Got it. Worst case scenario, I'm fine with maintaining the FaunaDB subscription. Curious if it's easy to switch to a Droplet or require a lot of time to migrate.

ghost commented 2 years ago

Migrating would be a day or two's work because Fauna is proprietary (oof) so DB-related code needs to be rewritten. If we migrate then let's agree to make it unbilled time :sweat_smile: I feel really bad because this is my own mistake reaching for Fauna not realising how restrictive the free tier would end up being + handwaving the proprietary concern.

dustinvtran commented 2 years ago

LOL. Well, up to you I guess. If it takes more hours than you'd expect, feel free to bill it---e.g., the # hours it would take as if you had originally started from the droplet-based solution.

mtamc commented 5 months ago

I think this has been fixed by migrating to free MongoDB.