Does a CDN help alleviate server load? My current server is getting overloaded and I am contemplating between using CDN vs just upgrading the server. I am under the impression that CDN will take most of the image hits for me, leaving my server some breathing space, not sure if that's how it works. My question is, if my goal is to keep the server load "low" what is the best approach? Note: I am already using static cache.
1 Answer
Traditionally the CDN does the lifting for you on static resources.
Say you allow image uploads for your site. After you take the upload, you need to resize it into thumbnails, then serve the resulting data back to the browser when required.
A CDN could take care of some of this for you. But a CDN is normally used for making static resource download much more efficient, by having a server closest to the user automatically used via DNS AnyCast (which is expensive and a pain to deploy on your own - you may as well use someone elses system for a nominal fee). After the initial post-processing of an image upload, it doesn't "cost" much to pick up a static resource and send it to the client.
But what you really need to do is find out what is bogging your server down, and address that. You don't just throw solutions (and money) at the wall until one of them sticks.
You need to profile your server, and its workflow, and identify what the bottleneck actually is. It could be a shitty worker thread, or maybe you just need to add a cache header to a heavy-to-generate resource that doesn't need generating all the time (just an example, I realise you said you're already using a caching tier). Maybe you just don't have enough RAM, or your database is running on 5400 rpm disks.