One of the most powerful tools that Fastly offers is worldwide, instant purge. Come learn the ins and outs of how HTTP invalidation works in general and how purge and surrogate keys can be used to improve your site's delivery and get even more value from Fastly.
This talk will also cover the purge blast radius
Surrogate Keys are an amazing way to purge your content from cache, but they can be a bit scary when you aren't sure how many URLs this surrogate key is tied to or what kind of affect this will have on origin. Join the USA Today Network as we explain how we leverage big data tools, Go APIs, New Relic, and Sumo Logic to provide our users a suite of tools for purging content from Fastly. Developers love knowing the blast radius of their surrogate keys, while our engineers love the real-time metrics and notifications we get when developers are hard-purging content.
2. ! Background
○ Why is invalidation useful? - Hooman Beheshti, VP Technology
○ How Fastly invalidation works - Tyler McMullen, CTO
! Five Activities
! Special Guest: Kris Vincent (USA Today Network) on
Purge Blast Radius
Agenda
3. ! Mark Nottingham, Fastly Principal Engineer
○ Chair, HTTP and QUIC Working Groups in the IETF
○ Member, Internet Architecture Board
○ Lead editor, RFC7234 - HTTP Caching
○ Working with / on HTTP caching since 1995
Introductions
18. • Event driven content can be cached if
the CDN allows programmatic purging
• Work flow:
– Cache content normally, just like static
– Purge programmatically when there is a
change
– Repeat!
19. • Event driven content can be cached if
the CDN allows programmatic purging
• Work flow:
– Cache content normally, just like static
– Purge programmatically when there is a
change
– Repeat!
Instant!
49. ! We’ll be using Glitch as our origin
○ It has a built-in IDE and server, so you can edit code and see
the results immediately
○ The sample “news” application is NodeJS + Express + SQLite -
don’t worry!
! We’ll be creating a dedicated origin and Fastly service for each of
you, to show:
○ How to invalidate with manage.fastly.com
○ How to invalidate programatically
○ How Soft Purge works
○ How Surrogate Keys work
Activities Overview
50. ! Start here:
○ Remix this: https://glitch.com/~fastly-invalidation
○ Create a service at: https://manage.fastly.com
○ user: invalidation@mnot.net pass: 1nstantpurg3
! You should end up with:
○ Origin Editor URL: https://glitch.com/edit/#!/{your_project}
○ Origin URL: https://{your_project}.glitch.me
○ Edge URL: http://{your_domain}.prod.fastly.net
○ Service URL : https://manage.fastly.com/dashboard/services/…
Getting Set Up
52. ! Fastly Purge only invalidates Fastly
! Browsers and other downstream caches still cache!
! Sometimes this is OK, sometimes not
! Strategy:
Surrogate-Control: max-age=big_num
Cache-Control: max-age=0
Purge and Browser Caches
54. ! Sometimes, it’s good to keep a copy of the old response around
○ Validation with If-None-Match / If-Modified-Since
○ Serving stale with Stale-if-error
○ Soft Purge tells Fastly to set the freshness lifetime to 0
Soft Purge
56. ! Remembering URLs is tedious, error prone, and sometimes impossible
! Surrogate Keys allow you to assign synthetic identifiers to responses
Surrogate-Key: foo_template joes_content key123
! More than one response can be identified by a key!
! Limits
○ Key length: 1024 bytes (including spaces and hex-encoded values)
○ Total surrogate keys: 16,384 bytes
Surrogate Keys
59. ! Deactiviate and delete your Fastly services when you’re done
! Feel free to take the worksheets home and play more
! Questions / Comments? mnot@fastly.com
! Fill out your feedback forms, and thank you!
Wrapping Up