Skip to content
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.

Performance issue #14

Open
subhtak opened this issue Jul 19, 2017 · 1 comment
Open

Performance issue #14

subhtak opened this issue Jul 19, 2017 · 1 comment

Comments

@subhtak
Copy link

subhtak commented Jul 19, 2017

The offline feature works properly. However, there is no improvement in the website speed. Is it something to do with the theme? I am in Magento 1.93

@tgerulaitis
Copy link
Member

The Service Worker file by default requests every page from the network first, only falling back to cache if it doesn't get a response. This means that it's not really going to improve time to first byte in most cases. It does server all assets (CSS, JS, images) from cache, but the performance gain from that depends on several conditions:

  • If you use ETags and aggressive caching for your assets, the browser might not even need to request them
  • If you use a CDN for your assets, the requests could be quick enough to minimise the impact of having to make them

Moreover, the service worker only has any effect on 2nd page load - the first time a page with a particular set of assets is loaded, everything needs to be downloaded from the network anyway.

All in all, I'd say for a decent production setup I don't expect to see a considerable perfomance gain from using a service worker in a best case scenario. However, where the service worker really shines is in poor network conditions, e.g. on a 2G network (you can simulate that in Chrome's Developer Tools), where the cost of each network request is multiplied.

If you want to take further action to improve the caching of your site, for example by always serving certain pages from cache, I suggest playing around with the different service worker caching strategies and tweaking the service worker template file to suit your needs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants