intershop/helm-charts

PWA: Memcached should be cleared after PWA deployment

Closed this issue · 2 comments

Problem Description: In release 0.8.0-delta, the shared cache does cache documents but does not cache static files. This leads to the following problem when deploying a new PWA release: Pages like '/home' are still cached and be therefore delivered to the user's browser. That document contains file references as follows:

<link rel="stylesheet" href="/styles.3d6129b9da98bdd2.css">
<script src="/main.b3cda4b20a9d371f.js" type="module"></script>

Unfortunately, the new PWA can not resolve those resources anymore. The page looks broken (no styles, js).

Current work around: Manually restart memcached container immediately before and after the PWA deployment process, to reduce the probability of invalid cache entries.

Expected behavior: After deploying a new PWA release, the current cache should be flushed automatically.

dhhyi commented

This problem sounds familiar and cannot be handled safely other that switching from rolling deploy to recreate strategy.

What probably happens: The deployment is rolled out and continued requests hitting new nginx instances are cached using fading out SSR instances. That way referenced scripts in the cached entries are no longer available.
The PWA deployment was never made for rolling deploy.

Using Recreate strategy (configurable with #374) the deployment will be unavailable for a short time, but no faulty pages will be cached because all containers are torn down first before starting new instances.

As a workaround instruct Operations to manually clear the cache on deployment by restarting cache containers (in your case probably memcached) after the deployment is done.

The current solution to this problem is the suggestion from Danilo with update strategy Recreate, that can now be achieved with PWA Helm Chart 0.8.0 and above.