CDN против обновления сервера?

507
IMB

Помогает ли CDN снизить нагрузку на сервер? Мой текущий сервер перегружен, и я размышляю между использованием CDN и простым обновлением сервера. У меня сложилось впечатление, что CDN возьмет на себя большинство обращений к изображениям, оставив моему серверу немного передышки, не уверенный, так ли это работает. Мой вопрос: если моя цель состоит в том, чтобы поддерживать нагрузку на сервер на низком уровне, каков наилучший подход? Примечание: я уже использую статический кеш.

0

1 ответ на вопрос

1
Mark Henderson

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.

Похожие вопросы