1
0
Fork 0
forked from OpenNeo/impress
impress/config
Matt Dunn-Rankin 3ae8a265b2
Use Fastly to cache our PNG assets from S3
We've been serving images directly from `impress-asset-images.s3.amazonaws.com` for a long time. While they serve with long-lasting HTTP cache headers, and the app requests them with the `updated_at` timestamp in the query string; each GET request still executes a full S3 ReadObject operation to get the latest version.

In the past, this was only relevant to users on Image Mode, not Flash Mode. But now that everyone's on Image Mode, this matters a lot more!

Now, we've configured a Fastly host at `impress-asset-images.openneo.net`, to sit in front of our S3 bucket. This should dramatically reduce the GET requests to S3 itself, as our cache warms up and gains copies of the most common asset PNGs.

That said, I'm not sure how much actual cost impact this change will have. Our AWS console isn't configured to differentiate cost by bucket yet—I've started this process, but it might take a few days to propagate. All I know is that our current costs are $35/mo data transfer + $20/mo storage, and that outfit images are responsible for most of the storage cost. I hypothesize that `impress-asset-images` is responsible for most of the reads and data transfers, but I'm not sure!

In the future, I think we'll be able to bring our AWS costs to near-zero, by:
- Obsolete `impress-asset-images`, by using the official Neopets PNGs instead, after the HTML5 conversion completes.
- Obsolete `impress-outfit-images`, by using a Node endpoint to generate the images, fronted by a CDN cache. (Transfer the actual data to a long-term storage backup, and replace the S3 objects with redirects, so that old S3 URLs will still work.)

I hope this will be a big slice of the costs though! 🤞

(Note: I'll be deploying this on a bit of a delay, because I want to see the DNS propagate across the globe before flipping to a new domain!)
2021-05-12 22:50:05 -07:00
..
environments donation mailer 2014-09-10 14:32:54 -05:00
initializers Use Fastly to cache our PNG assets from S3 2021-05-12 22:50:05 -07:00
locales Select All + visual feedback 2015-09-26 14:22:11 -07:00
.gitignore move some deploy stuff from files into env 2015-07-17 17:47:58 -04:00
application.rb double whoops; the actual problem was that i hadnt restarted the background workers :P 2014-04-05 23:52:24 -05:00
basic_type_hashes.yml vandagyre basic colors (ugh, should be in database) 2014-11-14 19:33:30 -06:00
boot.rb rails 3 2010-05-14 18:12:31 -04:00
colors.txt add color Dimensional 2012-09-24 18:31:27 -05:00
colors_with_unique_bodies.txt support special colors in the infinite closet 2011-05-02 18:07:56 -04:00
deploy.rb move some deploy stuff from files into env 2015-07-17 17:47:58 -04:00
environment.rb rails 3 2010-05-14 18:12:31 -04:00
flex.yml substring-ish item name indexing using ngrams+keyword 2013-01-29 23:00:45 -06:00
item_zone_sets.yml refactoring search, removing database from set, fixing show.js to work with new swf 2010-06-22 12:42:25 -04:00
locale_meta.yml es goes public! 2013-02-16 21:39:04 -06:00
newrelic.yml new relic 2012-04-08 16:37:32 -05:00
nonstandard_colors.txt asset spider, yaaay 2010-11-27 18:41:06 -05:00
routes.rb oh huh. looks like remove/move are ready. 2015-09-26 19:55:09 -07:00
schedule.rb fix cron job scheduler 2012-07-24 12:05:34 -04:00
species.txt basic specs for items, including search 2010-05-15 11:38:45 -04:00
zones.yml zones are now a static resource, like species and color. database table remains for compatibility with main PHP app 2010-06-09 23:15:51 -04:00