极
极核实验室
Using a CDN but It's Slower? A Guide to Troubleshooting

Using a CDN but It's Slower? A Guide to Troubleshooting

AI summary
CDN stands for Content Delivery Network and is not inherently an acceleration tool. It can be slower when content is uncached, forcing reverse-proxy back-to-origin requests, and when added network complexity undermines optimized routes. To address this, identify your deployment: overseas servers without ICP filing serving globally, overseas-only, or mainland China serving globally. The latter two usually need little optimization. For global service from an unfiled overseas server, choose mainland-friendly Hong Kong/three-network servers and prioritize mainland-optimized CDNs plus region-based DNS resolution; CNAME access can preserve your preferred DNS. Free DNS plans may offer only limited line granularity.
包含显式广告和植入式广告 | 可用于自动化程序

Repost license

Request authorization before reposting and retain the authorization code, original URL, and go/affiliate links.

Original URL:https://www.geekcorelab.com/post/why-cdn-makes-website-slower-troubleshooting-guide

The commercial link is an authorized go short link that must stay on the reposted page. It records the source before sending readers to the original article.

What Is a CDN?

First, CDN is not for acceleration. The full name of CDN is Content Delivery Network, which has nothing to do with acceleration at all. So why do 90% of tutorials on the Internet teach you to use a CDN to accelerate your origin server?

pasted_file_1794193470191.png

pasted_file_1794193552516.png

The Root Cause of Slow CDN

To analyze why a CDN is slow, we first need to know what happens after putting a CDN in front.

When a visitor requests the website:

User -> CDN -> website

If the CDN has cached the content normally, the request will end at the CDN and be sent directly to the visitor; but if the CDN has not cached it, the CDN needs to request your origin server first and then send the response to the visitor. At this point, the CDN is acting as a reverse proxy.

At the same time, after adding a CDN, network complexity increases significantly. Your origin server may be on BGP-optimized routes, CN2-GIA optimized routes, etc., but the CDN may not be, and even the CDN's origin-pull path may not benefit from route optimization.

As a result, the user originally connected to your server successfully in 100 ms, but after putting a CDN in front, the user first spends 200 ms connecting to the CDN, and then the CDN spends another 200 ms pulling from the origin. Website performance decreases instead of increasing

How to Solve the Problem of Slow CDN Speeds

First, determine which situation you are in:

Overseas: collectively refers to regions not restricted by the GFW (including Hong Kong, Macao, and Taiwan regions of China)

  • Overseas servers without ICP filing providing services globally (including mainland China)
  • Overseas servers without ICP filing providing services to overseas users
  • Servers in mainland China providing services globally

The latter two cases require almost no special optimization operations; any usage of any CDN can achieve decent results

If it is the first case, pay special attention to server selection. Recommended is 雨云's Hong Kong, China region servers; three-network mixed or three-network direct connection is more friendly to mainland China and can also work well with CDNs like Cloudflare. Enter promo code github to get 50% off the first month.

pasted_file_1794194061174.png

For the first case, when choosing a CDN, follow these two principles as much as possible:

  • Mainland China optimization first
  • Region-specific resolution

Mainland China Optimization First

Not long ago, Alibaba Cloud, Tencent Cloud, and other vendors were imitating Cloudflare's CDN+DNS operating model, but due to insufficient financial resources and designers who had never used Cloudflare, they respectively designed a CDN cut down to a 'half reverse proxy' and a 'maze console' management page. However, they can still be used for domestic acceleration

However, if you have a favorite DNS provider, it is good to not host DNS with the CDN provider here (i.e., connect via CNAME instead of NS)

pasted_file_1794195661641.png

For example, I connected the domain resolution for my domestic site to Cloudflare, but used Alibaba Cloud ESA for the CDN. However, after all, it seems that for Alibaba Cloud, ESA and CDN are two different things

Region-Specific Resolution

Some DNS providers can configure route-specific resolution, but be sure to choose a DNS provider you think is good; I am only demonstrating here

pasted_file_1794195925052.png

Cloudflare seemingly does not support route-specific resolution; maybe paid subscriptions do, but I have never used a paid subscription. For most domestic vendors, in my attempts, most support route-specific resolution, and you can select fields like this when creating DNS records:

pasted_file_1794196037909.png

Of course, you can also select more granularly, but the free version can only select up to this granularity, or even

pasted_file_1794196081116.png

pasted_file_1794196095449.png

✨ Reactions & Feedback

Enjoyed this article? Share your reaction with the author

Comments

Discussion

Be kind and keep the discussion friendly.

Your email will not be shown publicly.

Loading...

Markdown supported.

Discussion

0 comments

Internal link graph

Loading internal links…

View linked articles