12. 12May 31, 2014
3 Pillars of Performance
NETWORK RENDER COMPUTE
“Good developers know how things work. Great developers know why
things work.” ~ Steve Souders, Head Performance Engineer, Google,
2013
14. 14May 31, 2014
Latency vs. Bandwidth impact on Page Load Time
“To speed up the Internet at large, we should look for more ways to bring
down RTT. What if we could reduce cross-atlantic RTTs from 150 ms to 100 ms?
This would have a larger effect on the speed of the internet than increasing a user’s
bandwidth from 3.9 Mbps to 10 Mbps or even 1 Gbps.” - Mike Belshe
Single digit % perf
improvement after
5 Mbps
Linear improvement
in page load time!
Source: https://www.igvita.com
15. 15May 31, 2014
Components of an HTTP request
• DNS lookup to resolve the hostname to IP address
• New TCP connection requires a handshake round trip to the server
• TLS handshake (not shown) with up to two extra server round trips
• HTTP request requires minimum of a one round trip to the server
o Plus server processing time
Source: https://www.igvita.com
26. 26May 31, 2014
• Avoid CSS Expressions
• Avoid Redirects
• Remove Duplicate Scripts
• Make Ajax Cacheable
• Configure Etags
• Use GET for AJAX Requests
• Post-load Components
• Preload Components
• Reduce the Number of DOM Elements
• Minimize the Number of iframes
• Minimize DOM Access
• Choose <link> over @import
• Avoid Filters
• Make favicon.ico Small and Cacheable
• Avoid Empty Image src
Many of these performance rules deal with how external components are managed. However, before these considerations arise you should ask a more basic question: Should JavaScript and CSS be contained in external files, or inlined in the page itself?
Using external files in the real world generally produces faster pages because the JavaScript and CSS files are cached by the browser. JavaScript and CSS that are inlined in HTML documents get downloaded every time the HTML document is requested. This reduces the number of HTTP requests that are needed, but increases the size of the HTML document. On the other hand, if the JavaScript and CSS are in external files cached by the browser, the size of the HTML document is reduced without increasing the number of HTTP requests.
The key factor, then, is the frequency with which external JavaScript and CSS components are cached relative to the number of HTML documents requested. This factor, although difficult to quantify, can be gauged using various metrics. If users on your site have multiple page views per session and many of your pages re-use the same scripts and stylesheets, there is a greater potential benefit from cached external files.