CDN vs own apache servers?

i know that CDN is just for static contents. but then i still have to spread out by apache servers to all corners of the world right? so when i have done it, why dont i just set up some dedicated apache servers in place only serving static content just like CDN?

are there real benefits from still using CDN compared to that scenario?


A CDN is used for any content that is going to be accessed a multitude of times in a lot of various locations. YouTube for example, uses a CDN.

The main advantage of a CDN is that you have a local Point of Presence for the majority of your internet users. If you notice that you're getting a lot of traffic from North America and England and Brazil, there's no way that all of them are getting an optimum experience, because if your servers are located in New Zealand, then they're all going to access at different speeds.

By putting your servers in the countries where you get the majority of your traffic from, and then directing the user to their closest server, you're eliminating a lot of potential bottlenecks.

Simply having "some dedicated servers only serving static content" does not alleviate this issue, as all your servers are going to be in the same place. If you're going to spread your servers out around the world, then your two scenarios are the same.

All that said, I would never bother to build my own CDN unless I was someone the size of YouTube or Facebook. There are a few providers out there who already have a massive, robust network that you can use. See the following ServerFault questions for more information:

  • How do CDN (Content Delivery Networks) server work?
  • scalability: when to use CDN?
  • How do I objectively compare the performance of different CDNs?
  • https://serverfault.com/questions/55396/cdn-recommendation
  • When does a CDN (content delivery network) become worth it?

The machine you use to power your application will be configured to handle your application needs. That configuration may not be optimal for static assets. You could run nginx/lighttpd on the same machine to deal with your static content and build your own CDN while keeping your application servers configured to run your application optimally. There is an inherent cost to doing it yourself versus subcontracting out portions of it to someone that does only that.

Whether it makes more sense to do it inhouse versus contracting a CDN is a financial/effort question that you'll need to answer, but, depending on your application, the servers you're deploying, the configuration you can come up with, you could avoid using a CDN vendor. You could focus on the application and allow someone to handle it, or, have to be well versed in handling the complete package.