Why the Web is so Slow
I just read the blog post Why is the web so slow? by Stoyan Stefanov. This gave me the idea to give some common reasons for the web to be slow. I've been using "web application" fairly sloppy here. It could also mean "website" etc. Here they are:
- Because of actual distance from your computer to the webserver. The upper limit is the speed of light. This means that it is an impossibility for information to travel from Sydney to London in less than ~0.056 seconds (17009 kilometers).
- Fetching a webpage requires a roundtrip of information; a request and response. This effectively nearly doubles the time to fetch something.
- The HTTP protocol does not support a single connection fetching multiple static assets in parallel.
- SSL requires a longer complicated handshake and extra CPU when sending and receiving data.
- Because of sloppy considerations of caching. Getting up to speed with a web application is pretty easy. Getting HTTP caching right requires some thought.
- Because many web applications have not migrated to use a CDN. If we come together and all use CDNs, our visitors would be way more likely to have the common static files cached.
- Because of complex rendering of websites. The implications of complex HTML structure and CSS selectors is that rendering of a website is slow. KISS = Keep It Simple, Stupid.
- Because many web servers today are still not delivering compressed HTTP responses, such as GZip.
- Because many webdevelopers don't understand the implications of using slow third party assets. Yes, I'm looking at you Analytics and Ad Companies! Slow assets gives website visitors the feeling that the website is not done loading when 99% of the assets really are.
- Because we are sending cookies for a lot of content that does not require cookes.
- Because HTML is larger that it needs to be. Reusing CSS classes reduces the size of HTML to be fetched.
- Because images are sent when they really could be emulated using CSS. This is a thing of the past that still bugs me.
Google's networking protocol SPDY aims to solve some of these issues and make the web faster.
Did I miss something? Feel free to comment below!