105
Evolution of the CDN Hooman Beheshti, VP Technology SPA2015

SPA2015: Hooman Beheshti – The Future of CDNs

  • Upload
    fastly

  • View
    279

  • Download
    2

Embed Size (px)

Citation preview

Page 1: SPA2015: Hooman Beheshti – The Future of CDNs

Evolution  of  the  CDN

Hooman  Beheshti,  VP  Technology

SPA2015

Page 2: SPA2015: Hooman Beheshti – The Future of CDNs

CDN

• Globally  distributed  network  of  servers

• Built  primarily  with  caching  engines  (squid,  nginx,  varnish,  etc)

• Footprints  vary

Page 3: SPA2015: Hooman Beheshti – The Future of CDNs
Page 4: SPA2015: Hooman Beheshti – The Future of CDNs

CDN  benefits

• Performance• Latency  decrease  due  to  footprint

• Origin  offload

• Much  much  more…

Page 5: SPA2015: Hooman Beheshti – The Future of CDNs

Deployment

• Originally  simple:• Serve  root  web  page  (HTML)  direct  from  origin• Point  static  assets  on  the  page  to  a  domain  owned  by  the  CDN

• Everything  controlled  through  DNS

Page 6: SPA2015: Hooman Beheshti – The Future of CDNs

Types  of  content

CacheableUncacheable

Static

Dynamic

Page 7: SPA2015: Hooman Beheshti – The Future of CDNs

Cache-Control: max-age=31536000

Page 8: SPA2015: Hooman Beheshti – The Future of CDNs

Dynamic  Content

Page 9: SPA2015: Hooman Beheshti – The Future of CDNs

Transport  and  delivery  optimization

Page 10: SPA2015: Hooman Beheshti – The Future of CDNs

Transport  and  delivery  optimization

Page 11: SPA2015: Hooman Beheshti – The Future of CDNs

Application  delivery  platform

Page 12: SPA2015: Hooman Beheshti – The Future of CDNs

Things  have  started  changing…

Page 13: SPA2015: Hooman Beheshti – The Future of CDNs

Applications  have  became  smarter

Page 14: SPA2015: Hooman Beheshti – The Future of CDNs

Caching  has  gotten  more  complicated

Page 15: SPA2015: Hooman Beheshti – The Future of CDNs

CacheableUncacheable

Static

Dynamic

Page 16: SPA2015: Hooman Beheshti – The Future of CDNs

CacheableUncacheable

StaticDynamic

Page 17: SPA2015: Hooman Beheshti – The Future of CDNs

Static  =  Cacheable

All  Else  =  Dynamic  =  Uncacheable

Page 18: SPA2015: Hooman Beheshti – The Future of CDNs

Static  =  Cacheable

All  Else  =  Dynamic  =  Uncacheable

Page 19: SPA2015: Hooman Beheshti – The Future of CDNs

Types  of  content

CacheableUncacheableStatic

Dynamic

EventDriven

Page 20: SPA2015: Hooman Beheshti – The Future of CDNs

Static  for  unpredictable  periods  of  time

Event  Driven  Content:

Page 21: SPA2015: Hooman Beheshti – The Future of CDNs

Three  types  of  content

• Static• Infrequent  changes,  can  cache  for  a  long  time• Cache-­‐control  headers  are  often  good  enough• Examples:  images,  javascript,  css,  etc

• Dynamic• Can’t  cache  at  all  – must  go  to  origin• DSA  and  transport  optimization  is  key  for  performance• Examples:  logins,  credit  card  transactions,  Ajax,  etc

• Event-­‐driven:• Static,  but  unpredictably• Cache-­‐control  headers  are  not  good  enough  on  their  own• Examples:  news  stories,  wiki  pages,  user  comments,  sports  scores,  etc

Page 22: SPA2015: Hooman Beheshti – The Future of CDNs

Three  types  of  content

• Static• Infrequent  changes,  can  cache  for  a  long  time• Cache-­‐control  headers  are  often  good  enough• Examples:  images,  javascript,  css,  etc

• Dynamic• Can’t  cache  at  all  – must  go  to  origin• DSA  and  transport  optimization  is  key  for  performance• Examples:  logins,  credit  card  transactions,  Ajax,  etc

• Event-­‐driven:• Static,  but  unpredictably• Cache-­‐control  headers  are  not  good  enough  on  their  own• Examples:  news  stories,  wiki  pages,  user  comments,  sports  scores,  etc

Page 23: SPA2015: Hooman Beheshti – The Future of CDNs

Three  types  of  content

• Static• Infrequent  changes,  can  cache  for  a  long  time• Cache-­‐control  headers  are  often  good  enough• Examples:  images,  javascript,  css,  etc

• Dynamic• Can’t  cache  at  all  – must  go  to  origin• DSA  and  transport  optimization  is  key  for  performance• Examples:  logins,  credit  card  transactions,  Ajax,  etc

• Event-­‐driven:• Static,  but  unpredictably• Cache-­‐control  headers  are  not  good  enough  on  their  own• Examples:  news  stories,  wiki  pages,  user  comments,  sports  scores,  etc

Page 24: SPA2015: Hooman Beheshti – The Future of CDNs

Long-­‐tail  Content(cacheable  but  seldom  fetched)

Page 25: SPA2015: Hooman Beheshti – The Future of CDNs

Usage  patterns  have  changed

Page 26: SPA2015: Hooman Beheshti – The Future of CDNs

CDN  problems

• Services  were  black  boxes• Lots  of  professional  services• Caching  efficiency  has  decreased• Not  a  lot  of  visibility• No  real-­‐time  feedback• No  real-­‐time  interfaces

• APIs• Not  enough  real-­‐time  control

• Removing  content  from  the  CDN• Configuration  changes

Page 27: SPA2015: Hooman Beheshti – The Future of CDNs

CDNs  have  to  evolve…

Page 28: SPA2015: Hooman Beheshti – The Future of CDNs

Caching

Page 29: SPA2015: Hooman Beheshti – The Future of CDNs

Caching  event-­‐driven  content

• Caching  predictably  static  content  is  relatively  straight  forward• Headers• Configuration

• Caching  unpredictably  static  content  is  really  difficult• We  don’t  know  lifetime  in  advance• Trigger-­‐based  invalidation

Page 30: SPA2015: Hooman Beheshti – The Future of CDNs
Page 31: SPA2015: Hooman Beheshti – The Future of CDNs
Page 32: SPA2015: Hooman Beheshti – The Future of CDNs
Page 33: SPA2015: Hooman Beheshti – The Future of CDNs

Cache-Control: max-age=600

Page 34: SPA2015: Hooman Beheshti – The Future of CDNs

Uncaching

Page 35: SPA2015: Hooman Beheshti – The Future of CDNs

Purging

Page 36: SPA2015: Hooman Beheshti – The Future of CDNs

Purging  content  from  a  CDN

• Event-­‐driven  content  can  be  cached  if  the  CDN  allows  instantaneous  programmatic  purging• Cache  normally• Purge  when  change  trigger  happens• Rinse  and  repeat!

• Slow  purge  times  unacceptable  in  this  case

• We  need  instant purging• Deterministic  and  predictable

Page 37: SPA2015: Hooman Beheshti – The Future of CDNs

Example:CMS  +  Purge

Page 38: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Then

CDN  Node

Page 39: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Then

CDN  Node

Page 40: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Then

CDN  Node

Page 41: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Then

CDN  Node

Page 42: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Then

CDN  Node

Cache

Page 43: SPA2015: Hooman Beheshti – The Future of CDNs
Page 44: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Now

CDN  Node

Page 45: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Now

CDN  Node

HTTP/1.1 200 OKContent-Type: text/htmlContent-Length: 55,666Cache-Control: Totally Long Time!

Page 46: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Now

CDN  Node

HTTP/1.1 200 OKContent-Type: text/htmlContent-Length: 55,666Cache-Control: Totally Long Time!

Page 47: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Now

CDN  Node

Page 48: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Now

CDN  Node

Page 49: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Now

CDN  NodePURGE

Page 50: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Now

CDN  NodePURGE

Page 51: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Now

CDN  Node

(Has  to  be  instantaneous!)

PURGE

Page 52: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Now

CDN  Node

HTTP/1.1 200 OKContent-Type: text/htmlContent-Length: 55,666Cache-Control: Totally Long Time!

Page 53: SPA2015: Hooman Beheshti – The Future of CDNs

WordPress:  Now

CDN  Node

Page 54: SPA2015: Hooman Beheshti – The Future of CDNs

Long  tail  content  and  

cache  hit  ratio

Page 55: SPA2015: Hooman Beheshti – The Future of CDNs

Origin

Page 56: SPA2015: Hooman Beheshti – The Future of CDNs

Origin

Cache

Page 57: SPA2015: Hooman Beheshti – The Future of CDNs

TCP

Origin

Cache

Page 58: SPA2015: Hooman Beheshti – The Future of CDNs

HTTP

Origin

Cache

Page 59: SPA2015: Hooman Beheshti – The Future of CDNs

Origin

Cache

HTTP

Page 60: SPA2015: Hooman Beheshti – The Future of CDNs

Origin

Cache

HTTP

Page 61: SPA2015: Hooman Beheshti – The Future of CDNs

Origin

Cache

HTTP

Page 62: SPA2015: Hooman Beheshti – The Future of CDNs

Origin

Cache

HOT COLD

Page 63: SPA2015: Hooman Beheshti – The Future of CDNs

Origin

Cache

cache  “hit”

Page 64: SPA2015: Hooman Beheshti – The Future of CDNs

Popular Medium  Tail  (1hr) Long  tail    (6hr)

Page 65: SPA2015: Hooman Beheshti – The Future of CDNs

Popular Medium  Tail  (1hr) Long  tail    (6hr)

Connect  (median)Popular 14msec1hr  Tail 15msec

6hr Tail 16msec

Page 66: SPA2015: Hooman Beheshti – The Future of CDNs

Popular Medium  Tail  (1hr) Long  tail    (6hr)

Connect  (median)Popular 14msec1hr  Tail 15msec

6hr Tail 16msec

Page 67: SPA2015: Hooman Beheshti – The Future of CDNs

Popular Medium  Tail  (1hr) Long  tail    (6hr)

Connect  (median)Popular 14msec1hr  Tail 15msec

6hr Tail 16msec

Page 68: SPA2015: Hooman Beheshti – The Future of CDNs

Popular Medium  Tail  (1hr) Long  tail    (6hr)

Connect  (median)Popular 14msec1hr  Tail 15msec

6hr Tail 16msec

Page 69: SPA2015: Hooman Beheshti – The Future of CDNs

Popular Medium  Tail  (1hr) Long  tail    (6hr)

Connect  (median) Wait (median)Popular 14msec 19msec1hr  Tail 15msec 26msec

6hr Tail 16msec 32msec

Page 70: SPA2015: Hooman Beheshti – The Future of CDNs

Popular Medium  Tail  (1hr) Long  tail    (6hr)

Connect  (median) Wait (median)Popular 14msec 19msec1hr  Tail 15msec 26msec

6hr Tail 16msec 32msec 6,400+  measurements

77,000+  measurements

38,000+  measurements

Page 71: SPA2015: Hooman Beheshti – The Future of CDNs

Popular Medium  Tail  (1hr) Long  tail    (6hr)

Isn’t  this  better?

Page 72: SPA2015: Hooman Beheshti – The Future of CDNs

Object  storage

Page 73: SPA2015: Hooman Beheshti – The Future of CDNs

Caching

• Cache  more

• Serve  more  from  the  edge

• Control  caching  and  uncaching,  instantaneously  

Page 74: SPA2015: Hooman Beheshti – The Future of CDNs

Control

Page 75: SPA2015: Hooman Beheshti – The Future of CDNs

Programmability

• Granular  invalidation  API

• Configuration  API

• Logic  at  the  edge

• All  configuration  interaction  must  be  instantaneous

Page 76: SPA2015: Hooman Beheshti – The Future of CDNs
Page 77: SPA2015: Hooman Beheshti – The Future of CDNs
Page 78: SPA2015: Hooman Beheshti – The Future of CDNs

Control  at  the  edge

• Moving  application  logic  to  the  edge

• Example:  VCL  (Varnish  Configuration  Language)• Script-­‐like  configuration  for  functionality  at  the  edge

Page 79: SPA2015: Hooman Beheshti – The Future of CDNs
Page 80: SPA2015: Hooman Beheshti – The Future of CDNs

Control  at  the  edge

• Moving  application  logic  to  the  edge

• Example:  VCL  (Varnish  Configuration  Language)• Script-­‐like  configuration  for  functionality  at  the  edge

• Not  exclusive  to  varnish• Any  mechanism  offered  by  the  CDN  to  allow  logic  to  be  executed  at  the  edge  is  good

Page 81: SPA2015: Hooman Beheshti – The Future of CDNs

Logic  at  the  edge

• Generate  content  at  the  edge• HTTP  header  manipulation• Origin  selection• Caching  rules• Geo-­‐IP  rules• Forcing  SSL• Serving  stale  content  • Etc,  etc,  etc

Page 82: SPA2015: Hooman Beheshti – The Future of CDNs

Applications  without  origins?

Page 83: SPA2015: Hooman Beheshti – The Future of CDNs

Control

• Programmatic  interfaces

• Real-­‐time  interaction  with  the  CDN

• Running  logic  at  the  edge

Page 84: SPA2015: Hooman Beheshti – The Future of CDNs

Visibility

Page 85: SPA2015: Hooman Beheshti – The Future of CDNs

Real-­‐time  analytics

• Statistics  API• Network  stats• HTTP  stats  (status  codes,  etc)• Caching  stats  (hits,  misses,  errors,  etc)• Everything  has  to  be  real-­‐time• Historic  data  is  also  a  must

Page 86: SPA2015: Hooman Beheshti – The Future of CDNs

Logging

• Daily  or  hourly  logs  are  not  good  enough

• Logs  in  real-­‐time

• Log  streaming• To  any  logging  destination  endpoint• Syslog,  S3,  FTP,  etc.

Page 87: SPA2015: Hooman Beheshti – The Future of CDNs

Visibility

• We  need  to  see  what’s  going  on

• Real-­‐time  stats• Stats  API

• Real-­‐time  logs

Page 88: SPA2015: Hooman Beheshti – The Future of CDNs

Example:Beacon  Termination  at  the  Edge

Page 89: SPA2015: Hooman Beheshti – The Future of CDNs
Page 90: SPA2015: Hooman Beheshti – The Future of CDNs
Page 91: SPA2015: Hooman Beheshti – The Future of CDNs
Page 92: SPA2015: Hooman Beheshti – The Future of CDNs
Page 93: SPA2015: Hooman Beheshti – The Future of CDNs
Page 94: SPA2015: Hooman Beheshti – The Future of CDNs

Then

CDN  Node

Origin

Log  Analysis

http://collector.site.com/beacon.img?a=1&b=2&c=3

Page 95: SPA2015: Hooman Beheshti – The Future of CDNs

Then

CDN  Node

Origin

Log  Analysis

http://collector.site.com/beacon.img?a=1&b=2&c=3

Page 96: SPA2015: Hooman Beheshti – The Future of CDNs

Then

CDN  Node

Origin

Log  Analysis

HTTP/1.1 200 OKExpires: Wed, 19 Apr 2000 11:43:00 GMTCache-Control: no-cache, no-storeLast-Modified: Wed, 21 Jan 2004 19:51:30 GMTContent-Type: image/gifDate: Fri, 20 Jun 2014 12:22:20 GMTServer: ApacheContent-Length: 35

http://collector.site.com/beacon.img?a=1&b=2&c=3

Page 97: SPA2015: Hooman Beheshti – The Future of CDNs

Then

CDN  Node

Origin

Log  Analysis

HTTP/1.1 200 OKExpires: Wed, 19 Apr 2000 11:43:00 GMTCache-Control: no-cache, no-storeLast-Modified: Wed, 21 Jan 2004 19:51:30 GMTContent-Type: image/gifDate: Fri, 20 Jun 2014 12:22:20 GMTServer: ApacheContent-Length: 35

http://collector.site.com/beacon.img?a=1&b=2&c=3

Page 98: SPA2015: Hooman Beheshti – The Future of CDNs

Then

CDN  Node

Origin

Log  Analysis

HTTP/1.1 200 OKExpires: Wed, 19 Apr 2000 11:43:00 GMTCache-Control: no-cache, no-storeLast-Modified: Wed, 21 Jan 2004 19:51:30 GMTContent-Type: image/gifDate: Fri, 20 Jun 2014 12:22:20 GMTServer: ApacheContent-Length: 35

http://collector.site.com/beacon.img?a=1&b=2&c=3

Page 99: SPA2015: Hooman Beheshti – The Future of CDNs

Now

CDN  Node

Originhttp://collector.site.com/beacon.img?a=1&b=2&c=3

Page 100: SPA2015: Hooman Beheshti – The Future of CDNs

Now

CDN  Node

Origin

HTTP/1.1 200 OKExpires: Wed, 19 Apr 2000 11:43:00 GMTCache-Control: no-cache, no-storeLast-Modified: Wed, 21 Jan 2004 19:51:30 GMTContent-Type: image/gifDate: Fri, 20 Jun 2014 12:22:20 GMTServer: ApacheContent-Length: 35

http://collector.site.com/beacon.img?a=1&b=2&c=3

Page 101: SPA2015: Hooman Beheshti – The Future of CDNs

Now  (204)

CDN  Node

Origin

HTTP/1.1 204 No ContentDate: Sat, 21 Jun 2014 23:21:12 GMTServer: Awesome ServerContent-Length: 0

http://collector.site.com/beacon.img?a=1&b=2&c=3

Page 102: SPA2015: Hooman Beheshti – The Future of CDNs

Now

CDN  Node

Origin

Syslog  /  S3  /  FTP/etc

Streamed  W3C  Log

http://collector.site.com/beacon.img?a=1&b=2&c=3

Page 103: SPA2015: Hooman Beheshti – The Future of CDNs

Summary:  CDN  is  an  extension  of  the  app

• Flexible  caching…• …and  uncaching• All  tail  sizes  should  perform  comparably!• Control  over  functionality  at  the  edge• Real  time  interfaces  for  programmability• Logic  at  the  edge• Real-­‐time  visibility• Real-­‐time  analytics

Page 104: SPA2015: Hooman Beheshti – The Future of CDNs

The  future

• Security  (more  now  than  future!)

• Even  more  at  the  edge• More  logic• Other  parts  of  applications• More  delivery  features

Page 105: SPA2015: Hooman Beheshti – The Future of CDNs

Thank  [email protected]