Preserving good Google page rank metrics
Many have discovered that caching isn't a silver bullet. Varnish and Redis help scale, but unless care is taken, Google page ranking metrics will suffer.
If server response times are bad it will hurt your pagespeed score for sure. It will degrade the "Largest Contentful Paint" a lot.
Otherwise, most of the other metrics are frontend related, not the server response time, so Varnish doesn't have an impact.
Of course, if your resources are loading slowly, that will impact the rest of the scores, too, but frontend performance is mostly:
Minimizing the amount of loaded resources
- Lazy loading as many images that are not in view.
- Only loading JS libraries that are needed, and most importantly when they are needed.
Keeping the layout stable, and rendering it as soon as possible
This can be accomplished by
Instead, image and video sizes should be predefined. Images should be optimized and too large images should be avoided completely.
- Not rendering elements visible, and then makeing them invisible after JS has initialized (or the other way around).
Instead, pre-set the size of containers for things like cookie banners, news banners etc.
The most harmful JS libraries tend to be for chats, tracking, popups, cookie consent, search, etc.
These should be loaded using a facade.
For example, a chat Library should be loaded only when scrolled down X number of pixels, or on mouse-movement.
Search autocomplete library should only be loaded when the search field is clicked or focused.
Only load video thumbnails initially, and load the video embed/api only when the video/image is clicked.
GTM / Analytics
Finally, the hardest thing to optimize is GTM/Analytics.
Hopefully something like https://partytown.builder.io/ will resolve this in the future.