Content Delivery Networks ASP.NET

A CDN(Content Delivery Network) is a system of computers networked together across the Internet.The computers cooperate transparently to deliver content (especially large media content) to end users.CDN nodes (clusters of servers at a specific location) are deployed in multiple locations,often over multiple backbones.These nodes cooperate with each other to serve requests for content by end users.They also transparently move content behind the scenes to optimize the delivery process.A CDN serves a request by intelligently choosing the nearest server.It looks for the fastest connectivity between your computer to the nearest node that has the contentyou are looking for.A CDN measures its strength by the number of nodes in different countries and the amount of redundant backbone connectivity.Some of the most popular CDNs are Akamai, Limelight,and Edge Cast. Akamai is used by large companies like Microsoft,Yahoo!, and AOL.Comparatively, it is an expensive solution but has the best performance throughout the world because it has servers in almost every prominent city in the world.

Examining Web Site Performance Without a CDN

Every request from a browser goes to your server and travels through the Internet back bones that span the world.The more countries,continents, and oceans a request passes through to reach your server,the slower it is.For example, if you have your servers in the U.S.and someone from Australia is browsing your site, each request is crossing the planet from one end to the other to reach your server and then come back again to the browser.If your site has a large number of static files,including images, CSS,and Java Script,that are sending requests,then down loading them across the world takes a significant amount of time.

If you could set up a server in Australia and redirect users to your Australian server,then each request would take fraction of the time it takes from reach U.S. The net work latency would be lower and the data transfer rate would be faster,so static content will down load a lot faster.It will significantly improve the user’s performance if your web site is rich in static content. Moreover,ISPs provide far greater speed for a country-wide network compared to the Internet because each country generally has a 4 Mbps speed from servers that are in the same country, but the speed could drop to 512 kbps from servers that are outside the country. So, having a server in the same country or city significantly improves site speed.

Figure shows the average response time for www.sometargetdomain.com from Washington,D.C.,where the servers are in Dallas, Texas.The average response time is about 0.4 seconds.his response includes server-side execution time as well. Generally, it takes 0.3 to 0.35 seconds to execute the page on the server.So, time spent on the net work is 0.05 seconds or 50 ms.This conne- ctivity is really fast because it takes only four to six hops to reach Dallas from Washington D.C.

The average response time from Australia is 1.5 seconds, which is significantly higher than Washington D.C.,as you see from Figure 9-3.Moreover, it takes 17 to 23 hops to reach Sydney from Dallas. So,the site downloads at least four times slower in Australia than from anywhere in the U.S.

Average page download time from Washington D.C.

Average page download time from Washington D.C.

Average response time from Sydney, Australia is significantly higher than it is from Washington D.C.

Average response time from Sydney, Australia is significantly higher than it is from Washington D.C.

Different Types of CDNs

There are generally two types of CDNs:

Upload content to the CDN’s servers via FTP
By doing this you will get a sub domain in the CDN’s domain, e.g., drop things.somecdn.net. You then change all of the static content URLs on your site to download content from the CDN domain instead of from the relative URL on your own domain. For example, a URL like /logo.gif will be renamed to http://drop things. somecdn.net/logo.gif.This is easy to configure, but there are maintenance problems.

You have to keep the CDN’s store synchronized with the files all thetime.Deployment becomes complicated because you need to update both your web site and the CDN store at the same time. Cache Fly is an example of such a CDN (it is also very in expen- sive).

Store static content on your own site but use domain aliasing
You can store your content in a subdomain that points to your own domain, e.g.,static.dropthings.com.Then you use CNAME to map that sub domain to a CDN’s name server, such as cache.somecdn.net.When a browser tries to resolve static.drop things.com,the DNS lookup request goes to the CDN name server. The name server then returns the CDN node’s IP that is closest to you to give you the best download performance.

The browser next sends requests for files to that CDN node. When the CDN node sees the request,it checks whether it has the content already cached.If it is cached,it delivers the content directly from it local store.If not,it makes a request to your server and then looks at the cache header generated in response. Based on the cache header,the CDN node decides how long to cache the response in its own cache.In the meantime,the browser does not wait for the CDN node to get content and return to it (see Figure).

The CDN node that is closest to the browser intercepts traffic and serves a response

The CDN node that is closest to the browser intercepts traffic and serves a response

If it does not have the response in the cache,it fetches it from the origin server using a faster route and more optimized connectivity than the browser’s ISP can provide.If the content is already cached,then it’s served directly from the node.

The CDN does an interesting trick on the Internet backbone to actually route the request to the origin server so that the browser gets the response directly served from origin server while the CDN is updating its cache. Sometimes the CDN acts as a proxy, intercepting each request and then fetching uncached content from the origin using a faster route and optimized connectivity to the origin server.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

ASP.NET Topics