Protocol and transport
Its highly probably that the default tcp/ip settings are not tuned towards the latency and bandwidth profile of your website's visitors. Tune the network stack.
Enable HTTP Keep-Alive
Often a substantial part of the time spent waiting for the first render of a web page is caused
by the connection setup. This can take as much as 150ms for a trans-atlantic connection.
Enabling Keep-Alive allows browsers to re-use connections and thereby avoids the need to set up
a connection for each request.
Enable Gzip Compression
GZip Compression is an easy and effective way to save bandwidth and speed up your web pages.
The best way to compress redundant or unnecessary data is to eliminate it altogether.
Minification of the original assets in one thing, but with gzip compression it is often possible to
significantly reduce the size of the payload without affecting its actual meaning.
GZip compression is enabled at the server level.
Optimize HTTPS Performance
See Ilya Grigorik's work on this subject for diving deep.
- Enable and configure session caching and stateless resumption.
- Monitor your session caching hit rates and adjust configuration accordingly.
- Configure forward secrecy ciphers to enable TLS False Start.
- Terminate TLS sessions closer to the user to minimize roundtrip latencies - use a CDN.
- Use dynamic TLS record sizing to optimize latency and throughput.
- Ensure that your certificate chain does not overflow the initial congestion window.
- Remove unnecessary certificates from your chain; minimize the depth.
- Configure OCSP stapling on your server.
- Disable TLS compression on your server.
- Append HTTP Strict Transport Security header.
Leverage browser caching
Leverage browser caching by emitting the correct response headers to reduce the amount of duplicate work where possible and optimize page speed and bandwidth usage for repeat page views and asset downloads.
Async resources don't introduce a pause in DOM-construction in the browser. If the script is not essential for the first page render, you might also defer loading it until after the page has rendered.
Avoid long running scripts
Scripts will pause DOM construction and event processing of the page. If your script needs a lot of time to complete, breat it up into multiple steps so the browser can interleave work of its own and maintain page responsiveness to the visitor.
Scripts that are not involved in displaying the actual content which the visitor came to see should be deferred.
Optimize CSS Use
Defer CSS that is not critical to make the CSS payload as small and easy to download and process as possible for the browser.
Prioritize critical CSS
Prioritize CSS that is in the critical rendering path by inlining it, and defer loading of the rest of the CSS until after the page loads. The inlining will eliminate expensive server roundtrip(s) from the page rendering path, thereby speeding up the first time to render. Prioritize Critical CSS.
Eliminate redundant bytes in CSS by minifying it to lessen the amount of data that needs to be transferred.
CSS should be inside the document head tag
Put CSS as early in the html as possible to make sure the browser will start processing it as early as possible. Move CSS to the HEAD element.
Avoid CSS Imports
@import statements introduce server roundtrips into the critical path. Flatten CSS imports.
Inline render blocking CSS
For best performance, you may want to consider inlining the critical CSS directly into the HTML document. This eliminates additional roundtrips in the critical path and if done correctly can be used to deliver a “one roundtrip” critical path length where only the HTML is a blocking resource.