SlideShare a Scribd company logo
APACHE SLING & FRIENDS TECH MEETUP
10-12 SEPTEMBER 2018
The underappreciated power of content invalidation
Jakub Wądołowski, Cognifide (@jwadolowski)
2https://flic.kr/p/c7a8iE
There are only two hard things in Computer Science:
cache invalidation and naming things.
Phil Karlton
3
HTTP caching
What can be cached?
4
▪ HTTP response (body & headers)
▪ What makes response cacheable?
▪ Static assets only?
▪ Body encoding matters
▪ gzip, deflate, br, …
https://flic.kr/p/EWtcyL
Caching layers
5
▪ AEM (custom in-memory cache)
▪ Dispatcher
▪ CDN
▪ Web browser
https://flic.kr/p/Vh2TXE
6
Invalidation strategy
Invalidation models
7
▪ TTL-driven
▪ Event-driven
▪ Mix of both
https://flic.kr/p/Ra7cVb
Dispatcher invalidation
8
▪ 3 primary techniques
▪ by folder level (statfile)
▪ TTLs
▪ resource only
▪ Extras
▪ refetching
▪ custom script
https://flic.kr/p/mAYbSi
9
Invalidation request
10
11
Nothing fancy, huh?
12
▪ Plenty of possibilities
▪ handle related resources
▪ invalidate CDN’s cache
▪ push data to external systems
▪ …
https://flic.kr/p/qZygAC
13
CDN invalidation
The plan
14
▪ High hit ratio & cache coverage
▪ Long TTLs (30+ days)
▪ AEM content changes reflected quickly
▪ Precise invalidation
https://flic.kr/p/7F4bHa
Content view
15
▪ Dispatcher mirrors AEM content structure
▪ SEO-optimized customer-facing URLs
https://flic.kr/p/7rstvj
Dispatcher cache
16
www.example.org
www.example.org/help/about-us
www.example.org/summer-sale
www.example.org/product1-xyz
CDN cache
17
CDN cache keys
18
19
Invalidation APIs
20
▪ Multiple endpoints
▪ feature/authentication differences
▪ performance may vary
▪ Invalidation scope
▪ everything
▪ URL(s)
▪ tag
https://flic.kr/p/dgfRgD
DAM assets
21
▪ Sounds trivial?
▪ Renditions
▪ Alt texts
▪ Non-standard properties
https://flic.kr/p/9d2MRh
/content/dam/adaptto/image.jpg/jcr:content/renditions.1.json
22
/content/dam/adaptto/image.jpg/jcr:content/metadata.json
23
DAM invalidation script
24
Akamai API request
25
Alt text (1/3)
26
Alt text (2/3)
27
▪ Get all the pages that use given asset
▪ Query Builder API
Alt text (3/3)
28
Vanity URLs
29
▪ Each page can have a number of easy-to-
remember URLs
▪ Those pages are cacheable too
https://flic.kr/p/GDprQk
Vanity URLs (1/3)
30
Vanity URLs (2/3)
31
Vanity URLs (3/3)
32
Reusable components
33
▪ Common elements (i.e. header)
▪ SDI (Sling Dynamic Include) to the rescue
▪ SSI (Server Side Includes)
▪ ESI (Edge Side Includes)
https://flic.kr/p/dgghVK
34
35
Tag-based invalidation (1/4)
36
▪ Not everything can be wrapped into SSI/ESI
▪ Layout/templates
▪ HTML markup configs
▪ Is QueryBuilder the only option?
https://flic.kr/p/25LNnfK
Tag-based invalidation (2/4)
37
38
Tag-based invalidation (3/4)
39
40
Browser caching
Browser cache setup
41https://www.fastly.com/blog/understanding-vary-header-browser
Versioned clientlibs
42
▪ Generally a good idea
▪ Does it fit well into CDN setup?
https://flic.kr/p/9gTRKV
Cache-Control
43
▪ public/private
▪ max-age=<seconds>
▪ must-revalidate
▪ no-cache
https://flic.kr/p/5GCeGg
44
We barely scratched the surface…
45
▪ API throttling
▪ Error handling
▪ Payload limits
▪ Non-obvious content references
https://flic.kr/p/pSB1rM
Lessons learned
46
▪ purge all is dangerous
▪ make invalidation as precise as possible
▪ plan SSI/ESI since the very beginning
▪ QueryBuilder calls may require extra indexes
https://flic.kr/p/dgge8U
47
Thank you!

More Related Content

KEY
PDF
Steam Learn: An introduction to Redis
PDF
Redis Overview
PDF
Marian Marinov Clusters With Glusterfs
PDF
SPDY быстрее на 146% (Валентин Бартенев)
PPTX
Level 101 for Presto: What is PrestoDB?
PDF
Scaling Redis: Dmitry Polyakovsky
PDF
Integrating gluster fs,_qemu_and_ovirt-vijay_bellur-linuxcon_eu_2013
Steam Learn: An introduction to Redis
Redis Overview
Marian Marinov Clusters With Glusterfs
SPDY быстрее на 146% (Валентин Бартенев)
Level 101 for Presto: What is PrestoDB?
Scaling Redis: Dmitry Polyakovsky
Integrating gluster fs,_qemu_and_ovirt-vijay_bellur-linuxcon_eu_2013

What's hot (11)

PDF
Introduction to new high performance storage engines in mongodb 3.0
PDF
Writing Redis Module with Rust
PDF
Running OpenStack in Production - Barcamp Saigon 2016
PDF
OSBConf 2015 | Scale out backups with bareos and gluster by niels de vos
PDF
State of the_gluster_-_lceu
KEY
Legislation.gov.uk
ODP
Join the super_colony_-_feb2013
PDF
NoSQL solutions
ODP
Lcna example-2012
PDF
Hosting huge amount of binaries in JCR
Introduction to new high performance storage engines in mongodb 3.0
Writing Redis Module with Rust
Running OpenStack in Production - Barcamp Saigon 2016
OSBConf 2015 | Scale out backups with bareos and gluster by niels de vos
State of the_gluster_-_lceu
Legislation.gov.uk
Join the super_colony_-_feb2013
NoSQL solutions
Lcna example-2012
Hosting huge amount of binaries in JCR
Ad

Similar to The underappreciated power of content invalidation (20)

PDF
Thijs Feryn - Leverage HTTP to deliver cacheable websites - Codemotion Berlin...
PDF
Thijs Feryn - Leverage HTTP to deliver cacheable websites - Codemotion Berlin...
PDF
EVOLVE'14 | Enhance | Anshul Chhabra & Akhil Aggrawal | Cisco - AEM High Avai...
PDF
Caching the Uncacheable [Long Version]
PDF
Caching the Uncacheable: Leveraging Your CDN to Cache Dynamic Content
PPTX
cache concepts and varnish-cache
PDF
HTTP cache @ PUG Rome 03-29-2011
PPTX
Advanced HTTP Caching
PDF
When dispatcher caching is not enough... (extended version)
PPTX
When dispatcher caching is not enough by Jakub Wądołowski
PPTX
Spreadshirt Techcamp 2018 - Hold until Told
PDF
Caching Hypermedia APIs
PPTX
Cdn technology overview
PPTX
AEM (CQ) Dispatcher Security and CDN+Browser Caching
PDF
Developing cacheable backend applications - Appdevcon 2019
PPTX
The Most Frequently Used Caching Headers
PPTX
REST Api Tips and Tricks
PPTX
Web Caching Systems improve web performance by storing frequently accessed re...
PDF
HTTP cache: keeping it fresh
PDF
API Caching, why your server needs some rest
Thijs Feryn - Leverage HTTP to deliver cacheable websites - Codemotion Berlin...
Thijs Feryn - Leverage HTTP to deliver cacheable websites - Codemotion Berlin...
EVOLVE'14 | Enhance | Anshul Chhabra & Akhil Aggrawal | Cisco - AEM High Avai...
Caching the Uncacheable [Long Version]
Caching the Uncacheable: Leveraging Your CDN to Cache Dynamic Content
cache concepts and varnish-cache
HTTP cache @ PUG Rome 03-29-2011
Advanced HTTP Caching
When dispatcher caching is not enough... (extended version)
When dispatcher caching is not enough by Jakub Wądołowski
Spreadshirt Techcamp 2018 - Hold until Told
Caching Hypermedia APIs
Cdn technology overview
AEM (CQ) Dispatcher Security and CDN+Browser Caching
Developing cacheable backend applications - Appdevcon 2019
The Most Frequently Used Caching Headers
REST Api Tips and Tricks
Web Caching Systems improve web performance by storing frequently accessed re...
HTTP cache: keeping it fresh
API Caching, why your server needs some rest
Ad

More from Jakub Wadolowski (13)

PDF
Don’t reduce dispatcher testing to an afterthought
PDF
Automated CI with AEM Cloud service
PDF
The curious case of misrendered JSON
PDF
The shift to the edge
PDF
Image optimization at the edge
PDF
The shift to the edge
PDF
Taming content delivery at scale
PDF
Into the nooks and crannies of Boden’s digital transformation
PDF
How to seamlessly incorporate CDN into your application stack
PDF
Taming AEM deployments
PDF
(Re)discover your AEM
PDF
How to stay sane during your Vagrant journey
PPTX
When dispatcher caching is not enough...
Don’t reduce dispatcher testing to an afterthought
Automated CI with AEM Cloud service
The curious case of misrendered JSON
The shift to the edge
Image optimization at the edge
The shift to the edge
Taming content delivery at scale
Into the nooks and crannies of Boden’s digital transformation
How to seamlessly incorporate CDN into your application stack
Taming AEM deployments
(Re)discover your AEM
How to stay sane during your Vagrant journey
When dispatcher caching is not enough...

Recently uploaded (20)

PDF
Enhancing emotion recognition model for a student engagement use case through...
PPT
What is a Computer? Input Devices /output devices
PDF
Getting Started with Data Integration: FME Form 101
PPTX
Chapter 5: Probability Theory and Statistics
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PPTX
The various Industrial Revolutions .pptx
PDF
project resource management chapter-09.pdf
PPTX
Tartificialntelligence_presentation.pptx
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
PPTX
1. Introduction to Computer Programming.pptx
PPTX
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
STKI Israel Market Study 2025 version august
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
August Patch Tuesday
PPTX
OMC Textile Division Presentation 2021.pptx
Enhancing emotion recognition model for a student engagement use case through...
What is a Computer? Input Devices /output devices
Getting Started with Data Integration: FME Form 101
Chapter 5: Probability Theory and Statistics
A comparative study of natural language inference in Swahili using monolingua...
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
The various Industrial Revolutions .pptx
project resource management chapter-09.pdf
Tartificialntelligence_presentation.pptx
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
2021 HotChips TSMC Packaging Technologies for Chiplets and 3D_0819 publish_pu...
1. Introduction to Computer Programming.pptx
MicrosoftCybserSecurityReferenceArchitecture-April-2025.pptx
NewMind AI Weekly Chronicles - August'25-Week II
STKI Israel Market Study 2025 version august
gpt5_lecture_notes_comprehensive_20250812015547.pdf
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
August Patch Tuesday
OMC Textile Division Presentation 2021.pptx

The underappreciated power of content invalidation