问题原文
原帖链接 · Shiva · CC BY-SA 4.0
My WordPress website is connected to Cloudflare CDN. It runs quite smoothly as of now. The site speed is quite good in general.
However, when I load the website for the first time after like 10-15 minutes from a Chrome incognito browser tab, it loads around 0.5- 1.5 seconds slower. But after that whenever I visit by re-opening a new incognito tab, it loads fast. Again, when I visit after 10-15 minutes interval, it will load slower in the first attempt. But is fast in consecutive attempts.
The same thing I noticed in my phone's Chrome browser.
Why does it take this extra time to load and how can I improve it?
Thanks!
已采纳解答
原帖链接 · Maximillian Laumeister · CC BY-SA 4.0
Chrome's incognito window uses a fresh cache, so you could say that Chrome has two caches - a "normal" cache and an "incognito" cache. When you close ALL incognito windows and tabs, the incognito cache gets cleared. With default Chrome settings, the normal cache persists across windows and browsing sessions.
It takes extra time for your site to load in incognito because your browser is re-downloading a lot of the page's resources that it would otherwise have already cached, because it's working with a fresh incognito cache.
You can improve load times for repeat visitors by making sure your site's resources are being served with long-life cache headers where appropriate, so the browser won't re-download them for a long time.
You can improve load times for first-time visitors by making sure your site's resources are lean, so don't include tons of JavaScript, images, or other things that slow down page load - or load them on demand with e.g. the loading="lazy" image attribute or async and defer JavaScript attributes. This may come down to going lean on plugins.
You can improve load times for both by making sure your server hardware is fast (i.e. not on over-provisioned shared hosting) and your server software is lean (e.g. not bogged down by too many plugins).
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
