Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2021 Caching chapter #2443

Merged
merged 122 commits into from
Dec 14, 2021
Merged
Changes from 3 commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
e967b00
chapter init
Zizzamia Nov 6, 2021
46278e6
start connecting data into the chapter
Zizzamia Nov 7, 2021
f11cc4d
add back @rviscomi commits
Zizzamia Nov 20, 2021
d41903e
Update src/content/en/2021/caching.md
rviscomi Nov 23, 2021
ba3bccc
Merge branch 'main' into zizzamia/caching-2021
rviscomi Nov 23, 2021
b131347
figure images
rviscomi Nov 23, 2021
aa73e91
Optimised images with calibre/image-actions
github-actions[bot] Nov 23, 2021
1ddb677
Jessica help part I
Zizzamia Nov 27, 2021
2f6027a
Jessica help part II
Zizzamia Nov 27, 2021
16914f6
Jessica help part III
Zizzamia Nov 27, 2021
96ccfdc
Jessica help part IV
Zizzamia Nov 27, 2021
01c0984
Jessica help part V
Zizzamia Nov 28, 2021
5d239d3
Jessica help part VI
Zizzamia Nov 28, 2021
26d53a3
Update config to allow chapter to generate
tunetheweb Nov 28, 2021
2aa8576
intro
Zizzamia Nov 28, 2021
074b0d2
Merge branch 'zizzamia/caching-2021' of github.com:HTTPArchive/almana…
Zizzamia Nov 28, 2021
ac425f7
intro
Zizzamia Nov 28, 2021
977cb7f
CDN Cache
Zizzamia Nov 28, 2021
0540ced
sw
Zizzamia Nov 28, 2021
b7ec896
Jessica help part VII
Zizzamia Nov 28, 2021
c608284
headers
Zizzamia Nov 28, 2021
dd9c57d
cache
Zizzamia Nov 28, 2021
bfbc618
Update src/content/en/2021/caching.md
Zizzamia Nov 28, 2021
54495b8
Update src/content/en/2021/caching.md
Zizzamia Nov 28, 2021
7e971e7
cache
Zizzamia Nov 28, 2021
fc3718a
Update src/content/en/2021/caching.md
Zizzamia Nov 28, 2021
945c59c
Update src/content/en/2021/caching.md
Zizzamia Nov 28, 2021
c0d8c65
merge
Zizzamia Nov 28, 2021
c712424
directives
Zizzamia Nov 28, 2021
a733623
conclusion
Zizzamia Nov 28, 2021
6bb3fd9
polished intro
Zizzamia Nov 28, 2021
02092d7
polished cdn
Zizzamia Nov 28, 2021
a774ae5
sw cdn
Zizzamia Nov 28, 2021
7787a13
headers polish
Zizzamia Nov 28, 2021
a4f40e7
headers polish
Zizzamia Nov 28, 2021
bd6fce6
Update src/content/en/2021/caching.md
Zizzamia Nov 28, 2021
2efcf47
cut headers part
Zizzamia Nov 28, 2021
f32892d
big polish
Zizzamia Nov 28, 2021
5239f46
conclusion
Zizzamia Nov 29, 2021
ad00470
lh
Zizzamia Nov 29, 2021
b7d977e
bytes
Zizzamia Nov 29, 2021
89735a3
TTL
Zizzamia Nov 29, 2021
989d104
magic
Zizzamia Nov 29, 2021
f9fd687
resource age
Zizzamia Nov 29, 2021
e5a5173
clean up
Zizzamia Nov 29, 2021
4094253
Jess as Author
Zizzamia Nov 29, 2021
180ef36
Update src/content/en/2021/caching.md
Zizzamia Nov 29, 2021
399222f
Merge branch 'zizzamia/caching-2021' of github.com:HTTPArchive/almana…
Zizzamia Nov 29, 2021
84be3e4
😆
Zizzamia Nov 29, 2021
592901e
Update src/content/en/2021/caching.md
Zizzamia Nov 29, 2021
893df95
😁
Zizzamia Nov 29, 2021
8f8754e
🌲
Zizzamia Nov 29, 2021
c960b85
🌕
Zizzamia Nov 29, 2021
29e3b11
🔥
Zizzamia Nov 29, 2021
2abb7a4
📦
Zizzamia Nov 29, 2021
484e77b
🚀
Zizzamia Nov 29, 2021
cf1aed7
Zizzamia Nov 29, 2021
7525be7
Zizzamia Nov 29, 2021
a3c34ad
figure images
rviscomi Nov 29, 2021
fbadd6d
Optimised images with calibre/image-actions
github-actions[bot] Nov 29, 2021
51bca4f
Update src/content/en/2021/caching.md
Zizzamia Nov 30, 2021
8fbba3b
Update src/content/en/2021/caching.md
Zizzamia Nov 30, 2021
b3f4700
Update src/content/en/2021/caching.md
Zizzamia Nov 30, 2021
44e3af2
Update src/content/en/2021/caching.md
Zizzamia Nov 30, 2021
45617a9
Zizzamia Nov 30, 2021
54f65d7
💙
Zizzamia Nov 30, 2021
b260ff5
📚
Zizzamia Nov 30, 2021
9137bd3
🔥
Zizzamia Nov 30, 2021
2a5c61d
👾
Zizzamia Nov 30, 2021
538cbbe
🚨
Zizzamia Nov 30, 2021
a5b01bb
🌲
Zizzamia Nov 30, 2021
c581bfb
☕️
Zizzamia Nov 30, 2021
49cbe72
💙
Zizzamia Nov 30, 2021
99c39db
😱
Zizzamia Nov 30, 2021
a7c9a37
Merge branch 'main' into zizzamia/caching-2021
tunetheweb Nov 30, 2021
cc160b8
😁
Zizzamia Nov 30, 2021
57aeb21
Merge branch 'zizzamia/caching-2021' of github.com:HTTPArchive/almana…
Zizzamia Nov 30, 2021
30f7fb2
😎
Zizzamia Nov 30, 2021
c1ae7c4
Optimised images with calibre/image-actions
github-actions[bot] Nov 30, 2021
5ef9ff3
🐶
Zizzamia Nov 30, 2021
6870b18
Merge branch 'zizzamia/caching-2021' of github.com:HTTPArchive/almana…
Zizzamia Nov 30, 2021
52a440c
Merge branch 'main' into zizzamia/caching-2021
rviscomi Nov 30, 2021
d75f4ce
figcaptions
rviscomi Nov 30, 2021
f8adf5b
Optimised images with calibre/image-actions
github-actions[bot] Nov 30, 2021
bd94628
vary figures
rviscomi Nov 30, 2021
52317dd
Optimised images with calibre/image-actions
github-actions[bot] Nov 30, 2021
fa12ae9
🚀
Zizzamia Nov 30, 2021
622123e
stats
Zizzamia Dec 1, 2021
2c53040
🐶
Zizzamia Dec 1, 2021
0766c0f
🐶🐶
Zizzamia Dec 1, 2021
0564ebe
🐶🐶🐶
Zizzamia Dec 1, 2021
3aa4ffa
🐶🐶🐶🐶
Zizzamia Dec 1, 2021
8fa9fdf
🐶🐶🐶🐶🐶
Zizzamia Dec 1, 2021
cc8307a
Merge branch 'main' into zizzamia/caching-2021
tunetheweb Dec 1, 2021
25a1b47
Correct zizzamia's github name
tunetheweb Dec 1, 2021
d61dcf3
Merge branch 'main' into zizzamia/caching-2021
tunetheweb Dec 1, 2021
6c186ea
Tinypng images
tunetheweb Dec 1, 2021
b8e36d6
Fix avatar
tunetheweb Dec 1, 2021
034b13e
Merge branch 'main' into zizzamia/caching-2021
tunetheweb Dec 1, 2021
b84755e
🌲
Zizzamia Dec 3, 2021
98f62eb
🌲🌲
Zizzamia Dec 3, 2021
bc9cc91
🌲🌲🌲
Zizzamia Dec 3, 2021
80d9dc3
🌲🌲🌲🌲
Zizzamia Dec 3, 2021
55e3436
Merge branch 'main' into zizzamia/caching-2021
Zizzamia Dec 3, 2021
6f9e7b6
🌲🌲🌲🌲🌲
Zizzamia Dec 3, 2021
70cf382
Linting fixes
tunetheweb Dec 5, 2021
7e9fe68
Merge branch 'main' into zizzamia/caching-2021
tunetheweb Dec 5, 2021
3296063
Another linting fix
tunetheweb Dec 5, 2021
6127906
Merge branch 'main' into zizzamia/caching-2021
tunetheweb Dec 5, 2021
884954d
🌲
Zizzamia Dec 5, 2021
4d32fc0
Merge branch 'zizzamia/caching-2021' of github.com:HTTPArchive/almana…
Zizzamia Dec 5, 2021
19e478e
Merge branch 'main' into zizzamia/caching-2021
tunetheweb Dec 7, 2021
bfddfbc
Fix config
tunetheweb Dec 7, 2021
64081b3
Update 2021.json
roryhewitt Dec 10, 2021
b8916bf
Update caching.md
roryhewitt Dec 10, 2021
634c5b9
Merge branch 'main' into zizzamia/caching-2021
tunetheweb Dec 11, 2021
42651be
reviews
Zizzamia Dec 13, 2021
c5f5bb9
completed missing sentence
Zizzamia Dec 13, 2021
28c00fd
fix bio
Zizzamia Dec 13, 2021
8dafe38
Merge branch 'main' into zizzamia/caching-2021
tunetheweb Dec 14, 2021
34207f4
Retake images
tunetheweb Dec 14, 2021
8d2b9a7
Figure fick ups
tunetheweb Dec 14, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 142 additions & 4 deletions src/content/en/2021/caching.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---
#See https://github.com/HTTPArchive/almanac.httparchive.org/wiki/Authors'-Guide#metadata-to-add-at-the-top-of-your-chapters
title: Caching
description: TODO
description: Caching chapter of the 2021 Web Almanac covering ...
authors: [Zizzamia]
reviewers: []
analysts: []
reviewers: [jessnicolet]
analysts: [rviscomi]
editors: []
translators: []
zizzamia_bio: Leonardo is a Staff Software Engineer at <a hreflang="en" href="https://www.coinbase.com/">Coinbase</a>, leading initiatives that enable product engineers to ship the highest quality applications in the world at scale. He curates the <a hreflang="en" href="https://ngrome.io">NGRome Conference</a>. Leo also maintains the <a hreflang="en" href="https://github.com/Zizzamia/perfume.js">Perfume.js</a> library, which helps companies prioritize roadmaps and make better business decisions through performance analytics.
results: https://docs.google.com/spreadsheets/d/1-v3yR0LZIC3t4zWtqTgR3jJsKjjRMP-HATU2caP8e2c/
featured_quote: During the past year caching ...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adoption of cache headers continues to steadily grow....

featured_quote: TODO
featured_stat_1: TODO
featured_stat_label_1: TODO
Expand All @@ -17,4 +19,140 @@ featured_stat_3: TODO
featured_stat_label_3: TODO
---

## TODO
## Introduction

Over the past decade ...


## CDN Cache adoption

Talk about CDN adoptions, 14% of desktop pages use a Cloudflare CDN.

{{ figure_markup(
image="top-cdns.png",
caption="Adoption of the top CDNs.",
description="TODO",
chart_url="https://docs.google.com/spreadsheets/d/e/2PACX-1vSGgVDZ9RkFQLmk5C3_siIcH-8macUEZMobcC0o1z8frYj8NOkI_C2s_yE5ppMdxDAD5INjNsCBa3h1/pubchart?oid=2035524639&format=interactive",
sheets_gid="58739923",
sql_file="top_cdns.sql"
) }}

## Service Worker adoption

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we link to another article that explains service workers or at least define it before going into specifics?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great call


Talk about Service Worker adoptions, 1.2% of desktop pages registered a Service Worker, but 9% of mobile pages in the top 1000 registered a SW.

{{ figure_markup(
image="sw-adoption.png",
caption="Service Worker adoption.",
description="TODO",
chart_url="https://docs.google.com/spreadsheets/d/e/2PACX-1vSGgVDZ9RkFQLmk5C3_siIcH-8macUEZMobcC0o1z8frYj8NOkI_C2s_yE5ppMdxDAD5INjNsCBa3h1/pubchart?oid=688062455&format=interactive",
sheets_gid="802609299",
sql_file="service_worker_rank.sql"
) }}

## Headers adoption

Talk about headers trends, Cache-Control vs ETag vs Expires vs Last-Modified.

### Cache Control

Talk about Cache Control adoptions, 74% of responses on mobile pages include the Cache-Control header

{{ figure_markup(
caption="The percent of pages that use the Cache-Control header.",
content="74%",
classes="big-number",
sheets_gid="2102749619",
sql_file="todo.sql"
) }}
rviscomi marked this conversation as resolved.
Show resolved Hide resolved

Cache Control directives, 61% of mobile requests include a Cache-Control response header with a `max-age` directive.

The most common invalid Cache Control directives are: `set-cookie`, `max-stale`, `false`, `max-age:`, `maxage` and `public;`.

Fun fact the the largest max-age value is 1625540701883604800000 seconds or 51545557517871.8 years (51 trillion).

{{ figure_markup(
caption="TODO",
content="51 trillion years",
classes="big-number",
sheets_gid="529870849",
sql_file="todo.sql"
) }}

Talk about `immutable` directive, 12% of desktop requests containing Cache-Control: immutable are on the "static.parastorage.com" host.

Talk about invalid date, last modified and expires, (0.11% of dates in desktop requests are invalid).

### Vary

Talk about Vary adoption, 42% of requests on mobile set Vary: accept-encoding.

The most common Vary headers are: `accept-encoding`, `user-agent`, `origin`, `accept`.

### TTL adoption

Talk about 28% of mobile requests use neither Cache-Control nor Expires headers.

The median HTML resource on mobile has a TTL of 14 days

## Cookie Cache adoption

Talk about cookies.

Fun fact `test_cookie` is the most popular desktop and mobile cookie name at 4% of all cookies.

{{ figure_markup(
caption="TODO",
content="4%",
classes="big-number",
sheets_gid="455647224",
sql_file="todo.sql"
) }}

Top cookies attributes, SameSite is on 68% of cookies set in mobile responses.

## What type of content are we caching?

Talk about what kind of resources are we caching, (resource age groups: party, type).

Talk about resource age, the median HTML resource on mobile is 9 weeks old.

Talk about, total number of requests with comparable Last-Modified and expiration times, not necessarily all requests.

Talk about 54% of mobile resources are older than their TTL.

{{ figure_markup(
caption="TODO",
content="54%",
classes="big-number",
sheets_gid="768623684",
sql_file="todo.sql"
) }}

Total number of requests with comparable Last-Modified and expiration times, not necessarily all requests.

Talk about, 60% of 1P mobile resources are older than their TTL, which is more common than 3P resources (45%).

## How do cache TTLs compare to resource age?

The median difference between resource TTL and resource age is -6 days, meaning the age is 6 days older than the TTL.

## Identifying caching opportunities

Talk about ~100% of fonts on mobile are cacheable!

### Lighthouse TTL score
Talk about 12% of mobile pages score 0.9 or higher on the long TTL audit

### Lighthouse waysted bytes
Talk about 59% of mobile pages could save 0 - 1 MB with caching

## Future

TODO ...


## Conclusion

TODO ...