Harry Roberts digs into why hosting assets on someone else’s servers (including CDNs) is not such a great idea if we want our websites to be lightning fast.
One of the quickest wins—and one of the first things I recommend my clients do—to make websites faster can at first seem counter-intuitive: you should self-host all of your static assets, forgoing others’ CDNs/infrastructure.
I think perhaps the most shocking example Harry shows is this one:
…on a reasonably fast connection, hosting these static assets off-site is 311ms, or 1.65×, slower than hosting them ourselves.
By linking to three different origins in order to serve static assets, we cumulatively lose a needless 805ms to network negotiation. Full test. Okay, so not exactly terrifying, but Trainline, a client of mine, found that by reducing latency by 300ms, customers spent an extra £8m a year. This is a pretty quick way to make eight mill.
It’s clear from Harry’s example (as well as the rest of the examples on WPO stats) every millisecond counts when it comes to performance. And, if we can alleviate even a third of a second of latency by moving our assets around, we should probably go do that.
CSS Tricks Go to Source
Powered by WPeMatico