3

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

6
  • 3
    The real answer is "Maybe" because it really comes down to cost-benefit analysis. We don't know anything about the costs or benefits in this case. It's not just about where the viewers are, but how many of them there are. And the size of the country makes a big difference. In the US, visitors could be thousands of miles away but still in the same country, whereas in Lichtenstein, everyone's within a few dozen kilometers.
    – barbecue
    Dec 29, 2021 at 20:46
  • Even in a given country, all its ISPs might not be connected the same way and hence might not provide the same behavior to connect to any server in that given country. CDNs tend to try installing nodes closer to ISPs, if not inside ISPs directly, for this exact reason, so the geography is kind of irrelevant. Note also that sometimes traffic between two hosts in the same human country may leave in fact the country for various technical reasons (peering agreements) Dec 30, 2021 at 0:50
  • 1
    @PatrickMevzek Its possible - probable even that living on a large island (NZ) has skewed my perspective, but for a very long time all providers here peer or are routed via peers at a handful of exchanges. I know this is at least somewhat true in most places. Also, Cloudflare "only" claims data centers in 250 cities/100 countries - and not in Iran (where the op's profile suggests he is) - per cloudflare.com/network - so if the OP is hosting in and for Iran, and looking at Cloudflare as a CDN it is likely faster without it.
    – davidgo
    Dec 30, 2021 at 3:09
  • 1
    @davidgo I currently live in a small island without any local internet exchange so even local traffic between two hosts is often going international through a peering in another country. Dec 30, 2021 at 3:37
  • 1
    @davidgo Yes, your guess is right, the country we are talking about is Iran I should also add that filtering in the middle of the route affects Internet exchanges to or from Iran. In Iran, there is almost no request not to go through the filtering route Dec 30, 2021 at 8:54

2 Answers 2

6
+100

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)

3

The short answer is “Yes”.

CDN servers don't just improve performance by accelerating content by selecting the best internet paths, or caching it locally, they do many other things as well.

Without a CDN

How will you handle traffic spikes on days like Black Friday/Thanks Giving Day/Cyber Monday?

What will you do when your Data Center loses connectivity with Internet [in case of natural disasters]?

A CDN can also help you switch over to site without any downtime. In case of cyber attacks, how will you prevent them? Why do you want to spend your time and energy on things you do not suppose to be doing?

In today’s world, where anyone can make a botnet and start DDOSing you, how will you tackle them?

Is you server capable of scaling to any number of concurrent TCP connections?

Why don't you just funnel them through CDN servers?

Today, it's HTTP2, tomorrow it might be IPV6, day after tomorrow something else. It's a never ending story. Let experts do their job and you focus on your core business. Hope this helps in understanding why and how CDN helps in delivering your content over internet.

1
  • 5
    The backend of the webstore still needs to handle traffic spikes, connectivity losses, ddos and other attacks. If it can't, a CDN won't help you at all when the core part of the website becomes non-functional.
    – Bergi
    Dec 29, 2021 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.