4

i've read about CDN but dont know exactly what it is for.

lets say i've got an international social network (text and image content), and it's growing in traffic from different countries, do i have use of CDN?

the picture i got from the sources i've read is that it copy your content and put it in many servers spread out over the world so that users will fetch it from the nearest point.

does this mean that every server has a copy of my mysql database and the image files?

is this the proper way to make your web service available for the world? cause how else could you set up a servers through out the world, contacting hosting companies for each country?

ajsie
  • 1,215
  • 4
  • 20
  • 28
  • 5
    duplicate? http://serverfault.com/questions/63403/when-does-a-cdn-content-delivery-network-become-worth-it – warren Apr 05 '10 at 12:04
  • Your dynamic content, like your database is not copied, only static content like images, videos, and static HTML files... See akamai.com and limelightnetworks.com for more info. – Prof. Moriarty Apr 05 '10 at 12:26
  • 1
    @warren: not exactly a duplicate. they didnt say anything about dynamical content (mysql database). @prof. moriarty: so the LAMP server is still in my country. how can i set it up so the LAMP servers are spread all over the world and closer to the client like the static content? any good tutorials about how reaching an international public is done the right way on server side? – ajsie Apr 05 '10 at 12:27
  • 1
    it looked similar, but I see the differences now that you've pointed them out :) – warren Apr 05 '10 at 15:01

1 Answers1

4

A Content Delivery Network is usually used for static media. Some CDNs are Push and some are Pull, meaning that you either have to Push content to their servers and they replicate it among their own network of servers or they Pull from your site with a map that tells them that cdn.domain.com -> yourdomain.com/media/. Requests for static media are served from the CDN and pulled from the origin (your server) if they are not there.

A Pull CDN can also cache the origin (dynamic pages as well) keeping some functionality of your site alive if the origin server goes down. However, for a very interactive site, that won't be very helpful. A news site serving 5 minute old data is able to utilize a CDN to cache the origin a little better than a social media site where status updates taking 5 minutes to display could make or break you.

A CDN is usually a cache and holds very little intelligence at their edge. These are machines set up strictly to cache content and serve it quickly. While Akamai does support Edge Side Includes, getting them to actually do it is costly and somewhat difficult. Static content is generally what CDNs will cache.

Your mysql data and origin site functionality still exists in one place, but, your static content and possibly your cached pages would be served by the CDN. In order to run your site from multiple locations, you would need to run multiple servers with a 'director' that would send surfers to the closest server. You can do that with host naming, DNS Anycast or a director box. You would still need to run multiple LAMP servers in various data centers. There are hosting providers that can handle multiple location deployments and you can still use a CDN to offload your static content.

  • thank u for the excellent explanation! this is the kind of information i need. to know how to implement a web service not only from the perspective of programming, but also various distribution techniques. i have so many questions about this. are there any well renowned hosting providers that have hosting for different countries (just like CDNs) so you dont have to contact different hosting providers, one for each country? why is it better to use CDNs if your LAMP servers also are spreaded throughout the world? are there any good ebooks about all the options and best practices? – ajsie Apr 05 '10 at 17:42
  • Geographical close and network topologically close aren't always the same thing. Having a computer in every country where you have a presence isn't always necessary. Most of Europe can be served from Germany/Netherlands, US/Canada/Mexico from the US, South America from Panama, etc. If you are putting LAMP servers in different data centers, leveraging a CDN puts less load on your LAMP servers, which ultimately can allow you to scale out more or put less hardware in each of your hosting provider locations. –  Apr 05 '10 at 18:02
  • so are there any "popular" multi-location hosting providers that have server courts in Germany, Us, Panama etc? And the question still remains for why it's better to use CDNs instead of Apache servers when my servers also are wide spread. i could have some apache servers only serving static content too. so the question is, if i already have servers in different locations, why not put my own servers for static content, instead of using CDNs? Are there more distribution secrets im not aware of? some good books/sites covering these things and more? – ajsie Apr 05 '10 at 20:07