changes as often • 3rd party dependencies are a good candidate for a separate bundle • Minimize the amount of code that needs to be re-downloaded https://webpack.js.org/guides/caching/#extracting-boilerplate
• If the resource changes, the ETag value must also change • You can use a hash function to generate the ETag value based on the resource contents • Allows the browser to skip loading the resource if it hasn’t changed
conditions, and for how long • “public” or “private”: browsers will cache either, but intermediary caches such as CDNs will not cache private • “max-age”: number of seconds the response can be re- used from the time of the request • “no-cache”: always revalidate by checking first with server • “no-store”: never store the response data https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching
(e.g. servers) and requests are spread out, it can be even worse app.2eb2864b4e18.js index.html styles.543c2ad2230c.css vendor.6b06b7df03fa.js Origin 1 Origin 2
request an older version of a resource app.2eb2864b4e18.js index.html styles.543c2ad2230c.css vendor.6b06b7df03fa.js v1 v2 Not all origins get the same deployment at the exact same time +
for all origins to finish before moving to next stage. app.2eb2864b4e18.js styles.543c2ad2230c.css vendor.6b06b7df03fa.js Origin 1 Origin 2 Stage 1 index.html index.html Origin 1 Origin 2 Stage 2
is something akin to a docker container, here’s a working solution: • Before the actual deploy, copy all the files to some object storage (e.g. Amazon S3 or Google Cloud Storage). • If a request comes in for a file in the current deployment, great, we have it. • If we don’t have the file we can fallback to the object store.
no caching problems with these, using it as an alternative may lead to unexpected behaviour if the wrong version of the file is loaded, because the file on disk may not match the version in the query string