Eliminating Roundtrips with Preconnect
Last week we wrote about prefetching and preloading but forgot to mention
preconnect. Thankfully however, Ilya Grigorik has written a great post about this elusive resource hint:
Preconnect is an important tool in your optimization toolbox. As above examples illustrate, it can eliminate many costly roundtrips from your request path — in some cases reducing the request latency by hundreds and even thousands of milliseconds. That said, use it wisely: each open socket incurs costs both on the client and server, and you want to avoid opening sockets that might go unused. As always, apply, measure real-world impact, and iterate to get the best performance mileage from this feature.