- January 5, 2021
- 3 minute read
This is our second post in the series on improving your page load time according to Page Speed online tool results and according to Google's Web Performance Best Practices document that comes with the tool, along with the rules that fall into six categories altogether (minimizing Round Trip Times being the second). Page Speed evaluates how well your pages eliminate steps involved in page load time such as transmitting HTTP requests, downloading resources, parsing and executing scripts, and resolving DNS names, and according to these results you can act to speed up a component which is slowing you down the most.
Please consult our previous blog post that deals with caching also (Best Practices for Caching).
Round trip time (RTT) is the time required for a signal pulse or packet to travel from a specific source such as the computer that initiates the signal, to a specific destination such as a remote computer or system, and back.
Image 1 - Round Trip Time (RTT)
Image source: Wikimedia
In a nutshell, RTT is the time between a request for data and the complete return or display of that data. RTT can be determined by pinging a certain address and depends on many factors such as connection source, connection medium, physical distance between the actual source and the remote system, number of nodes between them, traffic amount, number of other requests handled by the server and so on. The RTT can range from a few milliseconds (thousandths of a second) under ideal conditions to several seconds under adverse conditions between points separated by a large distance.
For a browser to initiate a first-time connection with a web server, it must incur a minimum of 3 RTTs: 1 RTT for DNS name resolution, 1 RTT for TCP connection setup, and 1 RTT for the HTTP request and first byte of the HTTP response. Many will require dozens of RTTs which is a huge factor contributing to latency. Minimizing the number of RTTs is thus crucial for improving a page load time, even for "fast" broadband connections.
To save yourself the trouble of long round-trips, you can try reducing the number of serial round-trips by doing more in parallel and getting rid of excess weight, or reducing the round-trip-time by moving your location closer to the user, or finally, you can reduce the server time.
Image 2 - Median RTT (dating in 2002) from CAIDA project measuring topology and round-trip time across the Internet
Google's performance best practices suggest acting on several areas:
Reducing the number of unique hostnames from which resources are served cuts down on the number of DNS resolutions that the browser has to make. Minimizing HTTP redirects from one URL to another cuts out additional RTTs and wait time for users. Removing "broken links", or requests that result in 404/410 errors, avoids wasteful requests. Combining external scripts into as few files as possible cuts down on RTTs and delays in downloading other resources. Combining external stylesheets into as few files as possible cuts down on RTTs and delays in downloading other resources. Combining images into as few files as possible using CSS sprites reduces the number of round-trips and delays in downloading other resources, reduces request overhead, and can reduce the total number of bytes downloaded by a web page. Correctly ordering external stylesheets and external and inline scripts enables better parallelization of downloads and speeds up browser rendering time. Using document.write() to fetch external resources, especially early in the document, can significantly increase the time it takes to display a web page. Using CSS @import in an external stylesheet can add additional delays during the loading of a web page. Fetching resources asynchronously prevents those resources from blocking the page load. Serving resources from two different hostnames increases parallelization of downloads. Visualizing the page download accurately, as it really flows, is essential to performance analysis and acting on specific areas.
For minimizing round trip time, bandwidth doesn't matter. If bandwidth can be looked at as a diameter of a pipe through which data needs to travel, RTT can be compared to the time that data still needs to travel from one end of the pipe to the other and back (and this matters if you are in London, and your client is, for example, in Beijing). No matter how big the pipe. RTT must be handled the other way and without shortcuts, by combining the best practices mentioned above.
With over 10 years of experience, GlobalDots have an unparallel knowledge of today’s leading web technologies. Our team know exactly what a business needs to do to succeed in providing the best online presence for their customers. We can analyse your needs and challenges to provide you with a bespoke recommendation about which services you can benefit from.
GlobalDots can help you with the following technologies: Content Delivery Networks, DDoS Protection, Multi CDN, Cloud performance optimization and infrastructure monitoring.