Low latency means fast web content

Posted: January 31, 2010 in Network & Security
Tags: , , , , , , ,

-

Lets find out how low latency affects the speed of your web content. Before that lets look into detail  how TCP/IP functions. TCP/IP as we all know is the set of communications protocols used for the Internet and other similar networks. It is named from two of the most important protocols in it: the Transmission Control Protocol (TCP) and the Internet Protocol (IP), which were the first two networking protocols defined in this standard.

Data transfer using TCP/IP:
TCP, a connection oriented protocol use a well known mechanism called 3 way handshake for establishing and sharing data. This mechanism is designed so that two devices attempting to communicate can negotiate the parameters of the network connection before beginning communication. Both ends can initiate and negotiate separate connections at the same time. Simple demonstration of 3 way handshake mechanism.
-

Host A sends a TCP SYNchronize packet to Host B.

Host B receives A’s SYN

Host B sends a SYNchronize-ACKnowledgement.

Host A receives B’s SYN-ACK.

Host A sends ACKnowledge Host B receives ACK.

TCP connection is ESTABLISHED.

Once the connection is establishing, the TCP sender sends data bytes equal to the receiver’s window size x and waits for an ACK from the receiver. The receiver sends an ACK with the value y + x i.e. acknowledging that the last x bytes have been received OK and the receiver is expecting another transmission of bytes starting at byte y + x. After a successful receipt, the window size increases by an additional x called as Slow StartThe sender sends another datagram with 2x bytes, then 3x bytes and so on up to the MSS as indicated in the TCP Options.  After the required data has been sent the sender closes the TCP by the initiating a FIN packet. The connection closes successfully when an ACK has been sent by the other end.

TCP heavily emphasis on the use of ACK packet. For every single connection that is made or broken an ACK packet is used. If you add long distance between the two hosts, it will add more time for the ACK packet to be received back. Receive window scaling allows out to download large amounts of data simultaneously, but it will take more time to scale depending on the ACK packets received. Not to mention the sender has to wait for every ACK signal before sending the next data.

Here is a practical demonstration. Go to speedtest.net. Select the nearest test server to test your internet speed. After the test, select a different test server, this time from a different country/continent. You will find the speed of the nearest server higher. Knowing the fact that latency affects throughput, content provides like Akamai technologies have come up with the technology called as Content Delivery Network.

CDNs essentially cache content at the edges of the network, closer to users, thereby bypassing much of the performance bottleneck imposed by the Internet. CDNs are rapidly gaining in popularity because the current bandwidth limitations and the Internet’s manifestation as a collection of unrelated networks impede streaming content’s performance. Congestion at interconnection, or peering points, results in audio and video buffering and packet loss, all of which reduce performance and quality, yielding jerky, jittery reception.

How does a Content Delivery Network work ?

CDN nodes are usually deployed in multiple locations, often over multiple backbones. They cooperate with each other so that the data between these servers is always in sync. The webpage hosting the video or audio content is redirects/embeds the content by a common URL link. When your IP trys to resolve the URL, it queries your DNS server, which in-turn queries the Name server maintaining the zone file of the URL.  The Name server (depending on the geographic location of your DNS server) replies with the IP address of the CDN node. Thus your media is streamed from the nearest server.

Here is one example of a CDN, download.microsoft.com.

It has low TTL value compared to others domains (ttl: 86400 sec)

DNS lookup & ping using Local DNS server. Latency is low because microsoft’s name servers redirect the query from my local DNS to CDN’s nearest to my location.

DNS Lookup and Ping response  using Google public DNS. Latency is high since google DNS (located in the US) gets redirecting to its nearest CDN node by microsoft’s name servers.

Beyond the reliability and performance benefits, CDNs also reduces bandwidth costs, especially for websites that offer a large amount of content, as well as a reduction in server hardware cost if the site attracts many users. Also, a content-delivery service gives a website the ability to become instantly scalable by offloading such flash traffic as streaming webcasts that will be short-lived but have an instant impact on site capacity. Many online streaming websites like Youtube, yahoo, picasa, metacafe, orkut, cnet , viddler etc use CDN’s to reduce the load time for their rich media content.

Advertisement

Comments are closed.