What are the advantages and disadvantages of using a content delivery network (CDN)?
- The disadvantages may be that it costs money, and it adds a bit of complexity to your deployment procedures.
- The main advantage is an increase in the speed with which the content is delivered to the users.
When to use a CDN?
- It will be most effective when you have a popular public website with some type of static content (images, scripts, CSS, etc.).
Is a CDN a performance booster?
- In general, yes. When a specific request is made by a user, the server closest to that user (in terms of the minimum number of nodes between the server and the user) is dynamically determined. This optimizes the speed with which the content is delivered to that user.
- It increases the parallelism available.
(Most browsers will only download 3 or 4 files at a time from any given site.)
- It increases the chance that there will be a cache-hit.
(As more sites follow this practice, more users already have the file ready.)
- It ensures that the payload will be as small as possible.
(Google can pre-compress the file in a wide array of formats (like GZIP or DEFLATE). This makes the time-to-download very small, because it is super compressed and it isn’t compressed on the fly.)
- It reduces the amount of bandwidth used by your server.
(Google is basically offering free bandwidth.)
- It ensures that the user will get a geographically close response.
(Google has servers all over the world, further decreasing the latency.)
- (Optional) They will automatically keep your scripts up to date.
(If you like to “fly by the seat of your pants,” you can always use the latest version of any script that they offer. These could fix security holes, but generally just break your stuff.)