问题原文
原帖链接 · saeed arab sheybani · CC BY-SA 4.0
I'm surprised many people highly recommend CDN!
I'm dealing with an online store where 97% of its website traffic comes from one country, which considering the cost incurred shows that this site does not need a CDN. Do you think like me?
My question is whether or not to use a CDN in this situation
已采纳解答
原帖链接 · davidgo · CC BY-SA 4.0
The value of a CDN is use case dependent. As others have mentioned, a CDN can have benefits, but its not magic. In some edge cases it can actually slow things down - particularly if your server and client base are in the same geographic location, but the CDN isn't.
If you have fast, cheap traffic to your client base and your server can handle the loads, and you are not a target of DoS attacks and don't need to worry about uptime if you are suddenly targeted, you probably don't need a CDN.
Updated answer based on IRAN per comments
If you only care about people in your country, and the CDN is NOT in your country, you are likely better off NOT using a CDN. (As an outsider, reading relatively simplistic articles about Internet in Iran), I expect you would be better off taking steps to make your site better able to perform when within the governments framework, and I surmise the following may help -
Ensure you have Aggressive caching of images and static content and make sure they are as small as possible (so it is less likely to be downloaded during government mandated slowdowns).
Keep your dynamic content as lightweight as possible, seperating dynamic content from static content (eg CSS) as much as possible, and using well known, heavily cached libraries where useful (eg standard jquery with CSS linked from Google)
If you do go for a CDN, I believe there are only 2 in Iran, and I would not use one outside Iran (ie ArvanCloud and CDNvideo).
Without knowing much about the Internet layout of Iran, it might be worth running at least 2 sites in different provinces and making careful use of DNS (and controlling your DNS servers on the same networks as the 2 sites) to balance traffic if that's possible - certainly easier said then done with dynamic content. The idea being that very often slowdowns/blocks are partial or on major paths - by diversifying you can reduce the reliance on major paths. You also can attain many of the reliability benefits by having 2 sites - IF you can manage the complexity. (One way to partially do this may be to run your own caching reverse proxies - ie roll out your own mini CDN)
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
