Application Performance Series- Part 4- Use Content Delivery Network (CDN)

This is part 4 of a multiple part series on web performance improvements. The first Introductory blog can be found here. In previous part we discussed the pro and cons of DSN. In this part we will analyse how CDN’s can help us improve performance.
Whenever user types any URL in the browser, it sends the request to the server. The request travels all the way from client browser to the server. The server prepares the response and sends it back to the user browser.

The response time of request from browser-server and response back depends upon many factors such as:

  • Bandwidth
  • Network traffic
  • No of hubs in network path
  • Server load
  • Request/response data size
Consider two typical situations as in figure above. In First case the user and server, where website is hosted, are close to each other (in this example: same country, India). In Second case the two are in different countries (in this example: user is in India and server in USA).
So as distance between user and server increases the performance of the site for the user may decrease. As more and more factors, listed above, come into play the more they impact performance.
So what is CDN
According to http://www.webopedia.com content delivery network (CDN) is a system of distributed servers that deliver web-pages and other Web content to a user based on the geographic locations of the user, the origin of the webpage and a content delivery server. CDN is effective in speeding the delivery of content of websites with high traffic and websites that have global reach. The closer the CDN server is to the user geographically, the faster the content will be delivered to the user. CDN’s also provide protection from large surges in traffic.
Content delivery networks are used for B2B interactions and in serving content to consumers. Today, as more aspects of daily life move online, organizations use content delivery network to accelerate static content, dynamic content, mobile content, ecommerce transactions, video, voice, games and so on.
How CDN Works
Whenever a request is made servers nearest to the website visitor respond to the request. The CDN copies the pages of a website to a network of servers that are dispersed at geographically different locations, caching the contents of the page. When a user requests a webpage that is part of a content delivery network, the CDN will redirect the request from the originating site’s server to a server in the CDN that is closest to the user and deliver the cached content. The CDN will also communicate with the originating server to deliver any content that has not been previously cached.
The process of bouncing through a CDN is nearly transparent to the user. The only way a user would know if a CDN has been accessed is if the delivered URL is different than the URL that has been requested.
CDN Pros
The average user’s bandwidth increases every year, but a user’s proximity to your web server still has an impact on a page’s response time. Though the bandwidth is increasing so the content of the web pages. The web pages are not simple and light weight any more. They have lots of complex data of different types. So if the web servers are closer to the user, the response time of HTTP request is improved. Suppose the website is using multiple servers for hosting different components like images/assets, content etc. If these component web servers are closer to the user, the response times of all such components HTTP requests are improved. Due to these advantages it’s better to disperse the component web servers. This not only achieves a bigger reduction in response times, it’s also easier.
In addition to improved response times, CDNs bring other benefits. Their services include backups, extended storage capacity, and caching. A CDN can also help absorb spikes in traffic, for example, during times of peak weather or financial news, or during popular sporting or entertainment events.  
CDN Cons
In case of shared CDN hosting the web site response time can be affected by traffic from other web sites. A CDN service provider typically shares its web servers across all its clients. Another drawback is the occasional inconvenience of not having direct control of the content servers. For example, modifying HTTP response headers must be done through the service provider rather than directly by our own operations team. So, if CDN service provider’s performance degrades, so does our site’s.
Where can be used?
CDNs are used to deliver static content, such as images, scripts, style-sheets, and Flash. Serving dynamic HTML pages involves specialized hosting requirements: database connections, state management, authentication, hardware and OS optimizations, etc. These complexities are beyond what a CDN provides. Static files, on the other hand, are easy to host and have few dependencies. That is why a CDN is easily leveraged to improve the response times for a geographically dispersed user population.

0 Comments

Leave a Comment