Book Image

Building Scalable Apps with Redis and Node.js

By : Joshua Johanan
Book Image

Building Scalable Apps with Redis and Node.js

By: Joshua Johanan

Overview of this book

Table of Contents (17 chapters)
Building Scalable Apps with Redis and Node.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Static files and CDNs


We are currently using Express' static app to serve our JavaScript and CSS. A best practice for scalable sites is to push any static content onto a Content Delivery Network (CDN). If you have ever used Facebook (they do have a pretty large user base), you have used a CDN. If you inspect your Facebook profile, you will see a domain come up again and again, fbstatic-a.akamaihd.net. This is the CDN that Facebook uses for static assets. A CDN will have multiple servers across the world with the same content. Based on where the request comes from, the CDN will return the closest source. We are going to do something similar with this application using Amazon Simple Storage Service (S3).

Note

Some of you out there might say S3 is not a CDN, and you are correct. Amazon has CloudFront to do this. S3 will be better than serving static assets with Node.js, and until an application grows beyond a certain size and scope, S3 will fill the need of a CDN.

Creating an S3 bucket

We create...