A Tech Talk, 1/7/21
©2021 Copyright - Confidential and Proprietary
©2021 Copyright - Confidential and Proprietary
The fastest requests are the ones that are never made - someone, probably.
- Ryan Kanner
©2021 Copyright - Confidential and Proprietary
📝 The Spec
🍕The Ingredients
©2021 Copyright - Confidential and Proprietary
©2021 Copyright - Confidential and Proprietary
©2021 Copyright - Confidential and Proprietary
©2021 Copyright - Confidential and Proprietary
# Request
GET /article/123 HTTP/2
# Response
HTTP/2 200
Cache-Control: public
©2021 Copyright - Confidential and Proprietary
# Request
GET /article/123 HTTP/2
# Response
HTTP/2 200
Cache-Control: private
©2021 Copyright - Confidential and Proprietary
©2021 Copyright - Confidential and Proprietary
©2021 Copyright - Confidential and Proprietary
# Request
GET /article/123 HTTP/2
# Response
HTTP/2 200
Expires: Wed, 5 Jan 2022 07:28:00 GMT
©2021 Copyright - Confidential and Proprietary
# Request
GET /article/123 HTTP/2
# Response
HTTP/2 200
Cache-Control: max-age=3600, s-maxage=600
©2021 Copyright - Confidential and Proprietary
# Request 1
GET /article/123 HTTP/2
# Response 1
HTTP/2 200
ETag: 987
# Request 2
GET /article/123 HTTP/2
If-None-Match: 987
# Response if the content changed
HTTP/2 200
ETag: 654
# Response if unchanged
HTTP/2 304
©2021 Copyright - Confidential and Proprietary
# Request 1
GET /article/123 HTTP/2
# Response 1
HTTP/2 200
Last-Modified: Fri, 7 Jan 2022 12:00:00 GMT
# Request 2
GET /article/123 HTTP/2
If-Modified-Since: Fri, 7 Jan 2022 12:00:00 GMT
# Response if the content has changed
HTTP/2 200
Last-Modified: Sat, 8 Jan 2022 12:00:00 GMT
# Response if unchanged
HTTP/2 304
©2021 Copyright - Confidential and Proprietary
<img src="puppies.jpg" />
# Response
HTTP/2 200 OK
content-type: image/jpeg
Last-Modified: Fri, 27 Jul 2018 19:06:29 GMT
Date: Fri, 07 Jan 2022 17:22:11 GMT
expirationTime = currentTime + ((headers.Date - headers.Last-Modified) / 10)
©2021 Copyright - Confidential and Proprietary
<script src="app.l3kn1df4gln.js" />
# Response
HTTP/2 200 OK
content-type: application/javascript
Cache-Control: public, max-age=31557600
©2021 Copyright - Confidential and Proprietary
©2021 Copyright - Confidential and Proprietary
# Request
GET /users/me HTTP/2
Cache-Control: no-cache
# Response
HTTP/2 200
Cache-Control: no-store, must-revalidate
©2021 Copyright - Confidential and Proprietary
# Request
GET /articles/123 HTTP/2
Cache-Control: max-stale=600
# Response
HTTP/2 200
Cache-Control: max-age=3600
# TTL = 600
# Request
GET /articles/123 HTTP/2
Cache-Control: min-fresh=3600
# Response
HTTP/2 200
Cache-Control: max-age=600
# TTL = 3600
# Request
GET /articles/123 HTTP/2
Cache-Control: only-if-cached
©2021 Copyright - Confidential and Proprietary
©2021 Copyright - Confidential and Proprietary
# Request
GET /articles/123 HTTP/2
Cache-Control: stale-if-error=3600
# Response
HTTP/2 500
©2021 Copyright - Confidential and Proprietary
# Request
GET /articles/123 HTTP/2
# Response
HTTP/2 200
Cache-Control max-age=600, stale-while-revalidate=60
©2021 Copyright - Confidential and Proprietary
©2021 Copyright - Confidential and Proprietary
# Request
GET /articles/123 HTTP/2
Host: nerdwallet.com
# Response
HTTP/2 200
Cache-Control: max-age=600
Some Content
Key | Value | TTL |
---|---|---|
nerdwallet.com/articles/123 | Some Content | 600 |
©2021 Copyright - Confidential and Proprietary
# Request
GET /articles/123 HTTP/2
Host: nerdwallet.com
Accept-Language: es-es
# Response
HTTP/2 200
Cache-Control: max-age=600
Vary: Accept-Language
algo de contenido
Key | Value | TTL |
---|---|---|
nerdwallet.com/articles/123;Accept-Language=es-es | algo de contenido | 600 |
©2021 Copyright - Confidential and Proprietary
Normalization should be used to prevent high cardinality values from causing duplicate cache entries.
©2021 Copyright - Confidential and Proprietary
©2021 Copyright - Confidential and Proprietary
©2021 Copyright - Confidential and Proprietary
©2021 Copyright - Confidential and Proprietary