Current time: 09-26-2018, 09:49 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Preconnect all the things!.. sure?
04-05-2018, 01:46 AM (This post was last modified: 04-05-2018 01:55 AM by dario.)
Post: #1
Preconnect all the things!.. sure?
Hi!

I've a dilema about the preconnect resource hint header.

The "preconnect all the things" approach means that i'm going to warm up every domain i will use in the current page load, that it's good because as far i know Chrome keeps the connection open to that wormed up domain for 60 seconds or something like that. The risk here (i think) it's to collapse the mobile connections right? to do too many things at the beginning.. and also to increase the size of the initial http request header..

The other approach is to preconnect only the domains that affects the critical rendering path, here the page total load time will be increased because the following domains are not going to be warmed up.

I did some test but i've no RUM so they are synthetic tests that can misslead the conclusions, also the results are a little weird. I left the two screenshots attached.


What do you think it's the best approach?


Thanks!


Attached File(s) Image(s)
       
Find all posts by this user
Quote this message in a reply
04-05-2018, 04:47 AM
Post: #2
RE: Preconnect all the things!.. sure?
Hey Dario -

Good questions, I've wondered the same myself, which has led me to testing them. Honestly in all my efforts, I've failed to come up with a significant difference in overall page load speed by including/excluding the preconnect directive.

Granted, everyone's site is different, and testing (I think testing synthetically is fine for this situation, just make sure it's a consistent environment) is the best way for you to know in your own scenario.

I think common advice is it doesn't hurt anything to include a preconnect directive for your CDN, or anything that's referenced above the fold. But I wouldn't worry about listing every single domain that's used.

If I were you I'd focus on some other optimizations, such as your TTFB and blocking js.
Find all posts by this user
Quote this message in a reply
04-05-2018, 05:15 PM
Post: #3
RE: Preconnect all the things!.. sure?
yeap, i asked this same thing to Ilya Grigorik yesterday, this was his answer:

https://twitter.com/igrigorik/status/981775604323250176

Also doing some deep internet search i cross along this thread were this is being discuss:

https://github.com/GoogleChrome/lighthouse/issues/3106

I will revert today the preconnect all the things approach today, only will left our own CDN domains, i now believe that only preconnect only the domains that affect the CRP and the above the fold content it's the best approach Smile
Find all posts by this user
Quote this message in a reply
04-05-2018, 05:49 PM
Post: #4
RE: Preconnect all the things!.. sure?
I have seen improvements of > 1s by preconnecting to the domains that take a long time to establish SSL connections.

However, I also worry about putting a bottleneck in the mobile connections. That said, these are the ones going to benefit the most with preconnect IMHO.
Find all posts by this user
Quote this message in a reply
04-06-2018, 02:00 AM
Post: #5
RE: Preconnect all the things!.. sure?
That github issues link is super interesting. For those that don't have time to read it, my takeaway is that you shouldn't list more than 5 preconnects. And you should prioritize those 5 based on looking at your waterfalls and seeing which hosts really do need the speedup in connection setup.

Good find, thanks for bringing this up!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 2 Guest(s)