Background
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).
How One AI-Driven Media Platform Cut EBS Costs for AWS ASGs by 48%
Round Trip Time or RTT
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.
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 and the number of other requests handled by the server. 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.
How to measure RTT
RTT is typically measured in milliseconds using the Ping command. The Ping command is a command-line tool that measures the time taken for a data packet to be sent to a specific destination and come back again to the point of origin.
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.
Reducing a RTT using a CDN
CDNs use a variety of methods and techniques to reduce the RTT. CDNs cache and compress webpages which are then hosted in local data centers. A CDN uses a diverse network of geographically spread Points of Presence (PoPs) represented by local data centers, which contain cached copies of website content.
CDNs also cache media, HTML files which means that a user’s request can be addressed through a local PoP, which avoids the need for the request to travel to the main server. As content is delivered to users from servers based on the location, it helps in reducing the RTT, as the distance that a request has to travel is greatly reduced. CDNs also use compression technologies and image optimization techniques to improve the page load times for websites, which results in reduced RTT.
CDNs use load distribution techniques. During days of high traffic, CDNs have the capability to re-route service requests through alternate or backup servers which have lower network congestion. This speeds up server response time and reduces the RTT. As most CDNs use the cloud, high scalability is assured, which reduces the probability of any bottleneck due to infrastructure constraints. All the major CDNs have landmark agreements with the major ISPs to provide Tier I access to the Internet backbone. This has great significance, as it reduces the number of network hops that a request has to travel to, for reaching the destination. This has a major impact on the RTT.
Making a Long Trip Shorter
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.
Google’s performance best practices suggest acting on several areas:
- Minimizing DNS lookups
- Minimizing redirects
- Avoiding bad requests
- Combining external JavaScript
- Combining external CSS
- Combining images using CSS sprites
- Optimizing the order of styles and scripts
- Avoiding the document.write() command
- Avoiding CSS @import
- Preferring asynchronous resources
- Parallelizing downloads across hostnames
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. By reducing the number of HTTP redirects from one URL to another, enterprises can cut out additional RTTs and the waiting time for end users. Additionally, the number of wasteful requests can be reduced significantly by removing broken or invalid links. A further level of efficiency can be introduced by consolidating external scripts. This action can help in further reducing the RTT. Similarly, the overall data downloaded by a webpage can be reduced by combining images into a small number of files. This can also help in reducing the number of round-trips.
Using the document.write() command to fetch external resources 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. This issue can be addressed by fetching resources in an asynchronous manner. 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.
Implement with Experts
With over 17 years of experience, GlobalDots has an unparalleled knowledge of today’s leading web performance technologies. Our team knows exactly what a business needs to do to succeed in providing the best online presence for their end customers. We analyze your needs and challenges to provide you with a bespoke recommendation about which services you can benefit from.
GlobalDots is a world leader implementing web performance & security solutions, such as Content Delivery Networks & Multi CDN, innovative Bot Protection DDoS Protection, Cloud performance optimization and many more.
To minimize RTT and optimize your web assets’ overall performance, reach out to us by clicking here