Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Effective use of a CDN
Antti Siiskonen
Alma Mediapartners Oy
Me, myself and I
• Tampere University of Technology, 1996-2006
• Plenware Oy, 1999-2001
• Staselog Oy, 2001-2005
• Atostek...
Alma Mediapartners Oy
• a subsidiary of Alma Media Oyj, part of Alma Media's Marketplaces division
• 84 people, 26 of whic...
(yes, we are hiring)
What exactly is a CDN?
• a Content Distribution Network (CDN) is a distributed reverse http
proxy with cache
CDN
Edge
Orig...
What does "distributed" mean here..?
• Amazon Web Services (AWS) CloudFront CDN has 55 Edges around
the world
• each Edge ...
Ok, so what's a reverse http proxy then?
• a reverse proxy is a type of proxy server that retrieves resources on
behalf of...
Why would I want to use a CDN?
• to lower latencies and to provide a faster and better user experience
• to offload work f...
How long will a CDN cache my data?
• study RFC7234 - HTTP/1.1 Caching
• Origin should send hints for caching (time-to-live...
Static content
• for static content TTL should be practically indefinite
• static objects should be versioned and immutabl...
Dynamic content
• content regenerated on-demand or by manual or scheduled triggers
• TTL should be set based on the desire...
How easy is it to deploy a CDN?
• create an AWS account with a credit card
• use web UI to create CDN "distribution" and s...
Effect of AWS CloudFront CDN for
www.etuovi.com favicon.ico latency
Effect of AWS CloudFront CDN for
www.etuovi.com front page latency
How to make most of your CDN?
• design your cache keys carefully
• partition your resources and apply specific caching str...
Finally some pitfalls
• "There are only two hard things in Computer Science: cache
invalidation and naming things." -- Phi...
Thank you!
@AnttiSiiskonen
antti.siiskonen@almamedia.fi
https://www.linkedin.com/in/anttisiiskonen
Upcoming SlideShare
Loading in …5
×

Webbisauna.fi - Effective use of a CDN

368 views

Published on

A brief tutorial into what a CDN is and some experiences from using Amazon Web Services CloudFront CDN.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Webbisauna.fi - Effective use of a CDN

  1. 1. Effective use of a CDN Antti Siiskonen Alma Mediapartners Oy
  2. 2. Me, myself and I • Tampere University of Technology, 1996-2006 • Plenware Oy, 1999-2001 • Staselog Oy, 2001-2005 • Atostek Oy, 2005-2008 • Alma Media Interactive Oy & Alma Mediapartners Oy, 2008- • 38, married, three children
  3. 3. Alma Mediapartners Oy • a subsidiary of Alma Media Oyj, part of Alma Media's Marketplaces division • 84 people, 26 of which are in IT • 2015: turnover 13.7M€, profit 2.7M€ • 19% of turnover from banner ads • our current products are • etuovi.com, autotalli.com, vuokraovi.com, gofinland.fi • KIVI, Nettikoti, Websales, Autosofta
  4. 4. (yes, we are hiring)
  5. 5. What exactly is a CDN? • a Content Distribution Network (CDN) is a distributed reverse http proxy with cache CDN Edge Origin Client
  6. 6. What does "distributed" mean here..? • Amazon Web Services (AWS) CloudFront CDN has 55 Edges around the world • each Edge has tens or possibly hundreds of servers • CloudFront does large scale load balancing and distribution of traffic with DNS
  7. 7. Ok, so what's a reverse http proxy then? • a reverse proxy is a type of proxy server that retrieves resources on behalf of a client from one or more servers • usually Client only sees Edge directly and Origin remains hidden • Edge caches the response from the Origin and serves it to Clients
  8. 8. Why would I want to use a CDN? • to lower latencies and to provide a faster and better user experience • to offload work from the Origin • to create a distributed entry point to your infrastructure
  9. 9. How long will a CDN cache my data? • study RFC7234 - HTTP/1.1 Caching • Origin should send hints for caching (time-to-live, TTL) in http response headers • Expires: Thu, 15 Apr 2016 20:00:00 GMT • Cache-Control: max-age=31536000 • CDN will monitor how "hot" your objects are and act accordingly
  10. 10. Static content • for static content TTL should be practically indefinite • static objects should be versioned and immutable: • /img/kitten.jpg -> /img/kitten-5874a6573dee1613222b8b65e8eef1cb.jpg • /img/trololol.png -> /img/trololol-1.0.3.png • /img/pelle.jpg -> /img/pelle.jpg?v=1.0.3 • .. or TTL should be set to a carefully planned value
  11. 11. Dynamic content • content regenerated on-demand or by manual or scheduled triggers • TTL should be set based on the desired update interval • pass thru traffic may benefit from using a CDN as well
  12. 12. How easy is it to deploy a CDN? • create an AWS account with a credit card • use web UI to create CDN "distribution" and set it up • make appropriate DNS changes • AWS deploys a new CDN distribution usually in 15-20 minutes
  13. 13. Effect of AWS CloudFront CDN for www.etuovi.com favicon.ico latency
  14. 14. Effect of AWS CloudFront CDN for www.etuovi.com front page latency
  15. 15. How to make most of your CDN? • design your cache keys carefully • partition your resources and apply specific caching strategies • design, deploy, measure, repeat until good enough • apply other caching techniques as well if necessary
  16. 16. Finally some pitfalls • "There are only two hard things in Computer Science: cache invalidation and naming things." -- Phil Karlton • limiting access can be difficult • domain sharding • HTTP/2 will probably change a lot of things, so watch out
  17. 17. Thank you! @AnttiSiiskonen antti.siiskonen@almamedia.fi https://www.linkedin.com/in/anttisiiskonen

×