1
0
Fork 0
forked from OpenNeo/impress
Dress to Impress, a big fancy Neopets customization tool!
Find a file
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
.sass-cache phew. rails 3.2.12, including some asset pipeline. still buggy. 2013-03-05 20:08:57 -06:00
app Fix body ID bug saving SwfAsset outside modeling 2021-03-16 10:40:01 -07:00
autotest rspec:install 2010-05-14 18:17:10 -04:00
config Use Fastly to cache our PNG assets from S3 2021-05-12 22:50:05 -07:00
db Add db field to override special color 2018-05-09 14:10:20 -07:00
doc rails 3 2010-05-14 18:12:31 -04:00
lib prefer scraped rainbow pool images over pet images 2015-09-05 18:48:41 +00:00
public ignore public/uploads 2015-07-27 13:24:58 -04:00
script rails 3 2010-05-14 18:12:31 -04:00
spec news posts read from the database, with a campaign-supplement classname option :) 2015-09-26 20:37:03 -07:00
test core of pet loading, still needs get image hash, download assets 2010-10-07 10:46:23 -04:00
tmp utf-8 support in both ruby 1.9 and 1.8 2011-06-04 18:40:15 -04:00
vendor nvm, downgrade whenever 2015-07-17 18:26:31 -04:00
.gitignore move some deploy stuff from files into env 2015-07-17 17:47:58 -04:00
bundle rails 3.1 upgrade - still buggy 2013-03-05 15:10:25 -06:00
Capfile move some deploy stuff from files into env 2015-07-17 17:47:58 -04:00
config.ru move async behavior to development_async environment 2010-10-11 18:28:39 -04:00
Gemfile eheh, dont require capistrano 2015-07-17 22:15:56 -04:00
Gemfile.lock nvm, downgrade whenever 2015-07-17 18:26:31 -04:00
isntall rails 3.1 upgrade - still buggy 2013-03-05 15:10:25 -06:00
LICENSE copy LICENSE from impress repo 2010-07-07 02:34:17 -04:00
Rakefile update Rakefile and tasks to match new version of rake 2013-01-02 23:40:37 -05:00
README replace standard rails readme :P 2010-07-07 02:31:47 -04:00

An extension of Dress to Impress (PHP) that runs on Ruby on Rails.
I wanted to use Rails initially for Impress, but hoped that using
PHP would allow me to attract more developers. Looks like that
wasn't the case, so I just went with what I loved and made the
items database in Rails.

Future Impress sections will likely find themselves in this
project, rather than the PHP project.