slotlist / slotlist-backend

Backend of slotlist.info, an ArmA 3 mission planning and slotlist management tool
https://slotlist.info
MIT License
14 stars 6 forks source link

Add cache server via slotlist.info domain #89

Open MorpheusXAUT opened 6 years ago

MorpheusXAUT commented 6 years ago

We're currently not utilising Cloudflare's caching at all since images are loaded directly from GCP storage (also resulting in higher bandwidth costs). A solution to this (and future file hosting/static content caching) would be to add a cache server (most likely just a minimal nginx container) that proxies requests towards the appropriate GCP storage buckets. This would save external GCP bandwidth and allow for caching through Cloudflare.

Example: the mission image for Diyala Rumble is currently loaded from https://slotlist-info.storage.googleapis.com/images/uploads/missions/diyala-rumble/e643c149-53b1-4ce4-a8f2-32e47fd10e65. After the cache server introduction, the URL would be created as e.g. https://cdn.slotlist.info/images/missions/diyala-rumble/e643c149-53b1-4ce4-a8f2-32e47fd10e65. The nginx server listening to cdn.slotlist.info would the do a proxy_pass to slotlist-info.storage.googleapis.com and cache the image appropriately.


Tasks

regner commented 6 years ago

I guess this entirely comes down to the number of assets and the usage, but did you consider the GCP CDN?

MorpheusXAUT commented 6 years ago

For now, it's only approximately 50 images and usage is still pretty low, so it's probably not yet worth, although a valid suggestion! Unfortunately, it looks like the GCP CDN doesn't work without a GCP loadbalancer, which would add another flat... 16ā‚¬ or something on top of the current costs.

I'll see if the GCP -> nginx -> Cloudflare caching actually does anything, although with the rest of the k8s setup, it's mostly for experimenting, not so much due to an actual need šŸ˜„

Thanks for your suggestion though - was astonished to see an answer to one of my monologue-rambling issues šŸ˜›

regner commented 6 years ago

I probably pay way closer attention to this than I should :P

Do keep this updated with any testing you do though.