Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save nepsilon/9fda7732b6340c504b18ce1238dc97f7 to your computer and use it in GitHub Desktop.
Save nepsilon/9fda7732b6340c504b18ce1238dc97f7 to your computer and use it in GitHub Desktop.
Speed is a feature: 10 tips for faster browser networking — First published in fullweb.io issue #64

Speed is a feature: 10 tips for faster browser networking

1. Minimize TCP connections

Ensure the web server uses Keep-Alive headers.

2. Reduce DNS look-ups

DNS look-ups are the first thing blocking your HTTP requests.

3. Make less HTTP requests

Concatenating your scripts and CSS in a single app.js and styles.css is a good start. You can also inline (small) images.

4. Implement a good caching strategy

That means configuring Expires and ETag headers.

5. Gzip all assets

A compression level of 6 is a good compromise between file size and decompression speed.

6. Turn on TCP-Fast-Open

Not a silver bullet but something to try. It makes TCP send data earlier.

7. No redirect, please

Having redirection is essentially the same as doing another request.

8. Be closer to the user: CDN for the win

Put your assets geographically close to the user.

9. Consider HTTP pipelining

This allow several HTTP requests in a single TCP segment. The client and server must support it and worst case scenario need to he handled.

10. Increasing TCP’s Initial Congestion Window

TCP window size is small at first and increase as the network is seen stable. You can have TCP start with a bigger window size.

@tomByrer
Copy link

tomByrer commented Dec 2, 2016

1/2 of these are handled by HTTP2, so really should be a 'Top 5' list ;)

"DNS look-ups" cost can be reduced by <link rel="dns-prefetch" href="http://www.anothersite.com/">

Pre GZipping static assets at a higher (slower) ratio is better, & using z-standard or offering brotli is best in some situations.
But if you use a CDN, you might not have control over the compression, so just fogget about it B)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment