Must Know CDN Skillsets for Server Engineers

简介: This article uses to case studies to highlight must have skillsets for server engineers working with CDN. It will discuss CDN background and basic pri

In the cloud era, everyone is fighting to increase static resource loading speeds. In recent years, this alone has promoted the gradual popularization of CDNs, especially in rapidly expanding markets like China. I work in a company whose core business is centered on image sharing communities and therefore we rely heavily on image CDNs. This article uses to case studies to highlight must have skillsets for server engineers working with CDN. It will discuss CDN background and basic principles, distributed image storage, procedures and considerations for batch adding and switching CDNs as well as CDN access fault analysis.

Everything in this article is based from my own experiences. Background and principles of CDN and distributed image storage Before we start, let’s have a quick look at the basic CDN image storage architecture:

be0865209b1e49ac79b40ffe56fba1f7fed1ad92


These main principles of the above architecture can be illustrated in the diagram below:

db8edb81716f97f4944a64259b4e75626c5728f3

In this architecture we aim to switch the image access traffic for a certain domain name (a.mengkang.net) to the CDN. Here’s a rundown of the procedure:

  1. First, we need to collect statistics on the original domain name's access logs to find the image addresses with high access frequencies (around 200,000 addresses for example). Then, we will hand these addresses over to the CDN provider.

  2. The CDN provider will then do the warm-up crawling on the resources from the 200,000 addresses.

  3. After warm-up crawling is complete, when can change the domain name for a portion of a.mengkang.net to b.mengkang.net. Then, we need to resolve the b.mengkang.net CNAME to the CDN server's domain name, such as b.mengkang.ccgslb.com.cn.

  4. Using wget testing, we will access the images in the b.mengkang.net domain name to see whether or not they can be cached by the CDN.

  5. If the cache test is successful, we will switch some of the traffic from a.mengkang.net to b.mengkang.net. The O&M staff will monitor the back-to-source traffic situation and adjust the allocation of traffic accordingly.

Locating CDN resource access faults

Case Study 1:

Problem:

Recently we had a unique issue with large images. The access to the same image address sometimes succeeded and sometimes fails and when an image could not be accessed, individual image addresses access requests jumped to the game site's homepage.

We contacted the CDN provider's customer support and were told that the carrier's DNS was hijacked, but there was no problem with the CDN service (they seemed very passive). Here’s how we solved the problem.

Solution:

Let's use the following image as an example: http://f4.topit.me/4/2d/d1/1133196716aead12d4s.jpg

  • First, we confirmed that our origin site resources could be accessed and there was no problem with CDN back-to-source

    We used the wget command to bind the domain name host (here, we assumed the origin site IP is 111.1.23.214). This allows us to bypass the CDN and directly access our origin site:

    This confirms that the image can be accessed normally.

    e8b9ed2706c987f990954337ce5c7ed143e7a1c8

  • Then, we used wget -S to print out detailed HTTP header information

    9434f3a1fa4f89bf09bf04be754c3bcc4135183e

Using this request, we can clearly see that the request first connected to 123.150.50.14:80 and then experienced a 302 redirect. The header information clearly states: Powered-By-ChinaCache: HIT from CHN-TJ-7-3V2.6. This means that this is a problem with the CDN itself. Also, the redirect page also is a ChinaCache customer. Now that we had located the problem, the CDN provider could no longer deny responsibility and started fixing the problem.

Case Study 2:

Problem:

When accessing a certain webpage, the images in the CSS could not be accessed. However, images can be accessed by following the image address independently. Using wget --referer, we found that the problem was an incorrect anti-leeching setting:


8aad0243328afca0394f9b593e3fa3b508bd4d11


I reported this to customer service and they told me that they did not impose any restrictions and the problem is with our origin site. So we have to dig for evidences.

Solution:

  • First, we confirmed that there was no problem with the origin site by simulating browser access with a referrer

    6525aef74a3a0b336b141551c214d8e212f32e50

    At the same time, to bind the host, we also used another method: wget -e http_proxy

    cbc841a2dd9cb76ddbed2e3b8bbcd63ce178f6aa

  • Then, we requested directly, without binding the host

    93f0ddfedc66d1bb94bee4df6c18d94684ed2338

This clearly shows the domain name resolution process. The CDN DNS uses a predefined policy, returning the optimal IP, 111.202.7.252. Then, it returned 403. Only after I provided screenshots showing the two situations, the CDN customer service staff had to start fixing the problem.

Conclusion:

The above problems caused our development engineers to take on too much operations and management responsibilities. Recently we switched to Alibaba Cloud OSS for storage, and now we do not have to worry about the above problems anymore. There is no more back-to-source because we can directly store images on the cloud! It's that simple!

目录
相关文章
8-10|我是用htop看到 /data/soft/cdn-rsync/rsync -w /data/soft/cdn-rsync server --listen :8863如何重启这个程序
8-10|我是用htop看到 /data/soft/cdn-rsync/rsync -w /data/soft/cdn-rsync server --listen :8863如何重启这个程序
|
缓存 前端开发 JavaScript
适合阿里云CDN分发的文件类型有哪些?
静态文件如网页、图片、视频等适合CDN分发,可提升加载速度,减轻源站压力。动态、私有或频繁变更内容则不适合。合理选择资源包,助力高效上云。
阿里云CDN计费价格如何收费的?一文看懂
阿里云CDN计费包含基础费用与增值服务。基础费用可选按流量、带宽峰值或月结95带宽计费,默认按流量计费;增值服务如HTTPS、QUIC、WAF、实时日志等按使用量收费,不使用不计费。支持资源包抵扣,详情参考官方文档。
1401 10
|
缓存 监控 安全
如何设置阿里云CDN的流量阈值以避免超额费用?
在信息爆炸时代,阿里云CDN助力网站加速。合理设置CDN阈值可提升性能、节省带宽、增强安全。本文详解阈值配置步骤与监控优化,助你高效利用资源。无账号者可通过翼龙云上云,享技术支持与优惠。
|
缓存 前端开发 JavaScript
有哪些文件适合阿里云CDN分发?
静态、高频访问且对加载速度要求高的文件(如网页、图片、视频、下载文件)适合CDN加速,可提升性能与性价比;动态内容、私有数据、频繁更新或敏感资源则不宜使用。合理选择分发策略,优化体验并降低成本。
怎么调整阿里云CDN配额?
阿里云CDN助力网站加速,配额管理关乎性能与成本。本文详解带宽、流量、请求数配额定义,指导用户查看及申请提升配额,并解析费用影响与优化策略,助您合理规划资源,降本增效。
|
存储 监控 CDN
阿里云CDN怎么收费的?一文讲明白
阿里云CDN收费由基础服务费和增值服务费组成。基础费用必选,计费方式包括按流量、按带宽峰值或月结95带宽峰值三种;增值服务如HTTPS请求、QUIC请求、WAF防护和实时日志等按需使用,不使用不收费。本文详解2025年最新收费标准及计费规则。
|
域名解析 缓存 监控
阿里云渠道商:如何排查阿里云CDN访问问题?
排查阿里云CDN访问问题需分步诊断:先检查DNS解析与CDN基础配置,再根据访问慢、内容未更新或50x错误等现象定位原因,结合ping、tracert及阿里云实时日志、节点检测等工具深度分析。掌握此流程,快速解决异常。
|
边缘计算 缓存 双11
阿里云渠道商:什么时候应该使用阿里云 CDN 预热?
阿里云CDN预热可将资源提前分发至边缘节点,降低首字节时间50%以上,减轻源站压力。适用于大促活动、大文件发布、定期更新、突发流量及APP资源更新等场景,提升访问速度与稳定性。首次访问求快用预热,内容更新生效用刷新。
如何切换阿里云CDN的加速区域?
本文介绍如何通过阿里云CDN控制台切换加速区域,涵盖登录、域名管理、修改加速范围及注意事项,助企业轻松实现从中国大陆到全球的CDN加速调整,优化海外用户访问体验。