Is it better to use Cache or CDN?

前端 未结 5 1616
忘掉有多难
忘掉有多难 2020-12-22 21:26

I was studying about browser performance when loading static files and this doubt has come.

Some people say that use CDN static files (i.e. Google Cod

5条回答
  •  太阳男子
    2020-12-22 21:59

    A CDN has the benefit of providing multiple servers and automatically routing your traffic to the closest location to your client. This can result in faster delivery, optimized by location.

    Also, static content doesn't require special application servers (like dynamic content) so for you to be able to offload it to a CDN means you completely reduce that traffic. A streaming video clip may be too big to cache or should not be cached. But you don't neccessarily want to support that bandwidth. A CDN will take on that traffic for you.

    It is not always about the cache. A small application web server may just want to provide the dynamic content but needs a solution for the heavy hitting media that rarely changes. CDNs handle the scaling issue for you.

提交回复
热议问题