lighthouse icon indicating copy to clipboard operation
lighthouse copied to clipboard

[LCP] Add Recommendation to use the same domain as the root/site one for LCP Images in order to reduce LCP timing

Open gilbertococchi opened this issue 2 years ago • 6 comments

Serving LCP Images from non Root Site domain implies significant additional latency for sites and this may impact the likehood to meet the LCP threshold in the Lab and Field.

I believe Developers would find useful to see this opportunity exposed among the other audits exposed for LCP Images optimization.

gilbertococchi avatar Mar 16 '23 08:03 gilbertococchi

It would be extremely useful!

Dandi84 avatar Mar 16 '23 10:03 Dandi84

This is definitely a situation Lighthouse should highlight more prominently. Possibly a new audit, or it might make more sense to broaden uses-rel-preconnect to suggest bringing everything onto the same origin, and only if that's not possible suggest preconnecting.

brendankenny avatar Mar 16 '23 15:03 brendankenny

Hi brendankenny! Is there an update in this issue? Thanks!

mcmd avatar Oct 09 '23 23:10 mcmd

it might make more sense to broaden uses-rel-preconnect to suggest bringing everything onto the same origin, and only if that's not possible suggest preconnecting.

The obvious alternative to moving everything to the root origin is.... static assets are served on a static.somedomain.com host PLUS a preconnect. (Even better, advertise the preconnect in either the Link response header or Early Hints).

From a developer effort/difficulty POV, moving the image host under the same origin is likely pretty challenging for large hosts. (All the ones I know keep all static assets on a separate hostname). (Admittedly adopting early hints is not easy either).

All that to say, I think I'd favor a more aggressive preconnect audit than this origin-consolidation recommendation.

From a purely webperf POV, I think using this "obvious alternative" is arguably as good or better than a 1-origin setup. CDNs got plenty of benefits beyond just latency. And the time for the extra TCP connection should be mitigated by the preconnect (especially if its an early hint or link header)

paulirish avatar Nov 29 '23 00:11 paulirish