dbarnett / mumindme_web

Web app serving mumind.me
https://mumind.me/
0 stars 0 forks source link

CDN/caching/blocking #9

Closed dbarnett closed 3 months ago

dbarnett commented 6 months ago

Seems like I'm paying significant networking costs even on days where logs show no interesting traffic (besides indexing bots and stupid hackers trawling for URLs like "/.git/config"). Setting up a CDN might help, and maybe there are some other ways to block malicious requests before they end up costing me.

With the old GAE python app I was getting trivial bills but now it's charging ~$0.60/d for "Networking", and I'm having trouble even figuring out if the costs are more related to the number of requests or the size or something else.

dbarnett commented 6 months ago

Few possibly-relevant resources:

Seems the global load balancer is "Premium" tier and there's no way to downgrade that without changing the type of load balancer. Not sure how that compares to what I used to pay for the GAE equivalent. I think traffic going through CDN would be totally separate from that load balancer?

dbarnett commented 5 months ago

Alright, the costs seem to have nothing to do with actual network traffic and everything to do with the number of hours during which I have the global Load Balancer enabled, which is on "Premium" networking tier. Price for that is 0.025 USD/hr https://cloud.google.com/skus?currency=USD&filter=DEE3-C42E-3E4D. Seems like previously the price was free because I was using less than 28h×project: https://cloud.google.com/skus?currency=USD&filter=E2EB-F679-D108.

Need to figure out if there's a way to get a regional load balancer instead, which turns out to be completely unrelated to CDN/caching/blocking here.

dbarnett commented 3 months ago

Looks like I got this basically for free after moving to Vercel hosting! Their relevant docs say "Static files are automatically cached at the edge", and I did indeed see X-Vercel-Cache: HIT in requests for some image files that suggests it's working successfully.

That's for individual static files like images. OTOH it looks like if I hit a 404 page at a nonexistent path like http://mumind.me/walrusface, it doesn't cache that 404 page response, but for now it's not costing me anything so I can just revisit later if that changes.