Skip to content

Commit

Permalink
Update docs for image optimization swr (#34483)
Browse files Browse the repository at this point in the history
- Related to #27208 
- Related to #33735
  • Loading branch information
styfle committed Feb 17, 2022
1 parent 8545fd1 commit c0abf32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/api-reference/next/image.md
Expand Up @@ -402,7 +402,7 @@ module.exports = {

The following describes the caching algorithm for the default [loader](#loader). For all other loaders, please refer to your cloud provider's documentation.

Images are optimized dynamically upon request and stored in the `<distDir>/cache/images` directory. The optimized image file will be served for subsequent requests until the expiration is reached. When a request is made that matches a cached but expired file, the cached file is deleted before generating a new optimized image and caching the new file.
Images are optimized dynamically upon request and stored in the `<distDir>/cache/images` directory. The optimized image file will be served for subsequent requests until the expiration is reached. When a request is made that matches a cached but expired file, the expired image is served stale immediately. Then the image is optimized again in the background (also called revalidation) and saved to the cache with the new expiration date.

The expiration (or rather Max Age) is defined by either the [`minimumCacheTTL`](#minimum-cache-ttl) configuration or the upstream server's `Cache-Control` header, whichever is larger. Specifically, the `max-age` value of the `Cache-Control` header is used. If both `s-maxage` and `max-age` are found, then `s-maxage` is preferred.

Expand Down

2 comments on commit c0abf32

@ijjk
Copy link
Member

@ijjk ijjk commented on c0abf32 Feb 17, 2022

Choose a reason for hiding this comment

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

Stats from current release

Default Build (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
buildDuration 15s 14.7s -312ms
buildDurationCached 6s 6s -5ms
nodeModulesSize 359 MB 359 MB ⚠️ +2 B
Page Load Tests Overall increase ✓
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
/ failed reqs 0 0
/ total time (seconds) 2.935 2.945 ⚠️ +0.01
/ avg req/sec 851.8 849.02 ⚠️ -2.78
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.148 1.13 -0.02
/error-in-render avg req/sec 2177.1 2212.56 +35.46
Client Bundles (main, webpack, commons)
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
450.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42 kB 42 kB
main-HASH.js gzip 27.9 kB 27.9 kB
webpack-HASH.js gzip 1.44 kB 1.44 kB
Overall change 71.6 kB 71.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
_app-HASH.js gzip 1.36 kB 1.36 kB
_error-HASH.js gzip 194 B 194 B
amp-HASH.js gzip 312 B 312 B
css-HASH.js gzip 326 B 326 B
dynamic-HASH.js gzip 2.57 kB 2.57 kB
head-HASH.js gzip 350 B 350 B
hooks-HASH.js gzip 919 B 919 B
image-HASH.js gzip 5.05 kB 5.05 kB
index-HASH.js gzip 263 B 263 B
link-HASH.js gzip 2.26 kB 2.26 kB
routerDirect..HASH.js gzip 321 B 321 B
script-HASH.js gzip 383 B 383 B
withRouter-HASH.js gzip 318 B 318 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 14.7 kB 14.7 kB
Client Build Manifests
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
_buildManifest.js gzip 460 B 460 B
Overall change 460 B 460 B
Rendered Page Sizes
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
index.html gzip 531 B 531 B
link.html gzip 544 B 544 B
withRouter.html gzip 525 B 525 B
Overall change 1.6 kB 1.6 kB

Default Build with SWC (Increase detected ⚠️)
General Overall increase ⚠️
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
buildDuration 18.5s 18.1s -362ms
buildDurationCached 5.9s 6s ⚠️ +88ms
nodeModulesSize 359 MB 359 MB ⚠️ +2 B
Page Load Tests Overall increase ✓
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
/ failed reqs 0 0
/ total time (seconds) 2.915 2.911 0
/ avg req/sec 857.77 858.67 +0.9
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.132 1.123 -0.01
/error-in-render avg req/sec 2208.18 2226.06 +17.88
Client Bundles (main, webpack, commons)
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
450.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42.1 kB 42.1 kB
main-HASH.js gzip 27.9 kB 27.9 kB
webpack-HASH.js gzip 1.44 kB 1.44 kB
Overall change 71.7 kB 71.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
_app-HASH.js gzip 1.35 kB 1.35 kB
_error-HASH.js gzip 180 B 180 B
amp-HASH.js gzip 305 B 305 B
css-HASH.js gzip 321 B 321 B
dynamic-HASH.js gzip 2.56 kB 2.56 kB
head-HASH.js gzip 342 B 342 B
hooks-HASH.js gzip 911 B 911 B
image-HASH.js gzip 5.08 kB 5.08 kB
index-HASH.js gzip 256 B 256 B
link-HASH.js gzip 2.28 kB 2.28 kB
routerDirect..HASH.js gzip 314 B 314 B
script-HASH.js gzip 375 B 375 B
withRouter-HASH.js gzip 309 B 309 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 14.7 kB 14.7 kB
Client Build Manifests
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
_buildManifest.js gzip 459 B 459 B
Overall change 459 B 459 B
Rendered Page Sizes
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
index.html gzip 533 B 533 B
link.html gzip 548 B 548 B
withRouter.html gzip 528 B 528 B
Overall change 1.61 kB 1.61 kB

@ijjk
Copy link
Member

@ijjk ijjk commented on c0abf32 Feb 17, 2022

Choose a reason for hiding this comment

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

Stats from current release

Default Build (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
buildDuration 15.3s 15.1s -159ms
buildDurationCached 6.1s 6.1s -37ms
nodeModulesSize 359 MB 359 MB ⚠️ +2 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
/ failed reqs 0 0
/ total time (seconds) 3.003 3.017 ⚠️ +0.01
/ avg req/sec 832.42 828.58 ⚠️ -3.84
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.167 1.186 ⚠️ +0.02
/error-in-render avg req/sec 2141.78 2107.04 ⚠️ -34.74
Client Bundles (main, webpack, commons)
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
450.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42 kB 42 kB
main-HASH.js gzip 27.9 kB 27.9 kB
webpack-HASH.js gzip 1.44 kB 1.44 kB
Overall change 71.6 kB 71.6 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
_app-HASH.js gzip 1.36 kB 1.36 kB
_error-HASH.js gzip 194 B 194 B
amp-HASH.js gzip 312 B 312 B
css-HASH.js gzip 326 B 326 B
dynamic-HASH.js gzip 2.57 kB 2.57 kB
head-HASH.js gzip 350 B 350 B
hooks-HASH.js gzip 919 B 919 B
image-HASH.js gzip 5.05 kB 5.05 kB
index-HASH.js gzip 263 B 263 B
link-HASH.js gzip 2.26 kB 2.26 kB
routerDirect..HASH.js gzip 321 B 321 B
script-HASH.js gzip 383 B 383 B
withRouter-HASH.js gzip 318 B 318 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 14.7 kB 14.7 kB
Client Build Manifests
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
_buildManifest.js gzip 460 B 460 B
Overall change 460 B 460 B
Rendered Page Sizes
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
index.html gzip 531 B 531 B
link.html gzip 544 B 544 B
withRouter.html gzip 525 B 525 B
Overall change 1.6 kB 1.6 kB

Default Build with SWC (Decrease detected ✓)
General Overall increase ⚠️
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
buildDuration 18.5s 18.5s -56ms
buildDurationCached 5.9s 6.1s ⚠️ +136ms
nodeModulesSize 359 MB 359 MB ⚠️ +2 B
Page Load Tests Overall decrease ⚠️
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
/ failed reqs 0 0
/ total time (seconds) 2.986 3.003 ⚠️ +0.02
/ avg req/sec 837.18 832.39 ⚠️ -4.79
/error-in-render failed reqs 0 0
/error-in-render total time (seconds) 1.178 1.204 ⚠️ +0.03
/error-in-render avg req/sec 2122.18 2077.01 ⚠️ -45.17
Client Bundles (main, webpack, commons)
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
450.HASH.js gzip 179 B 179 B
framework-HASH.js gzip 42.1 kB 42.1 kB
main-HASH.js gzip 27.9 kB 27.9 kB
webpack-HASH.js gzip 1.44 kB 1.44 kB
Overall change 71.7 kB 71.7 kB
Legacy Client Bundles (polyfills)
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
polyfills-HASH.js gzip 31 kB 31 kB
Overall change 31 kB 31 kB
Client Pages
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
_app-HASH.js gzip 1.35 kB 1.35 kB
_error-HASH.js gzip 180 B 180 B
amp-HASH.js gzip 305 B 305 B
css-HASH.js gzip 321 B 321 B
dynamic-HASH.js gzip 2.56 kB 2.56 kB
head-HASH.js gzip 342 B 342 B
hooks-HASH.js gzip 911 B 911 B
image-HASH.js gzip 5.08 kB 5.08 kB
index-HASH.js gzip 256 B 256 B
link-HASH.js gzip 2.28 kB 2.28 kB
routerDirect..HASH.js gzip 314 B 314 B
script-HASH.js gzip 375 B 375 B
withRouter-HASH.js gzip 309 B 309 B
85e02e95b279..7e3.css gzip 107 B 107 B
Overall change 14.7 kB 14.7 kB
Client Build Manifests
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
_buildManifest.js gzip 459 B 459 B
Overall change 459 B 459 B
Rendered Page Sizes
vercel/next.js canary v12.1.0 vercel/next.js refs/heads/canary Change
index.html gzip 533 B 533 B
link.html gzip 548 B 548 B
withRouter.html gzip 528 B 528 B
Overall change 1.61 kB 1.61 kB

Please sign in to comment.