The Fundamental Knowledge of System Design (14) — Content Delivery Network (CDN)
It is a geographically distributed network of proxy servers and their data centers to provide high availability and performance by distributing the service spatially relative to end users.
Please support me if you feel that I contribute value to you!
Last 3 months, I feel that my earnings diminished almost immediately. I get harder to achieve the earnings I want, but if I stop, I feel sorry for my referred members. Please let me know the reasons and how to improve it.
It is the fourteenth series of the fundamental knowledge of system design. You can read my previous articles.
With the development of Information technology and the growing number of users, it brings a bottleneck in transmission efficiency through the network.
Even if you installed 100M broadband at home watching dramas, movies, browsing websites, or streaming, you still feel the network speed is slow.
It is because of the distance between the servers and the users. If the number of users increases, it causes network congestion that affects the overall transmission efficiency.
There is also the issue of bandwidth. A large number of servers is used to support the network bandwidth when there is a lot number of users browsing the same websites.
CDN is designed to solve these 2 problems.
CDNs store static content (such as HTML, large file downloads, video, audio on demand, live streaming media, and image files) in multiple locations around the world. When a client makes a request, the closest CDN location will be selected.

Technical Principle
To understand the concept of CDN, we must understand how the client makes a request.

- Users type the domain name in the browser URL bar to initiate a request to a designated server
- The browser requests the resolution of the websites from the local DNS server
- If the local DNS server has the resolution result of the websites, it directly responds to the request and returns the IP address corresponding to the website
- If the local DNS server does not have the resolution result of the website, it will recursively request the authoritative DNS for resolution, and then return the result to the user
- After the browser obtains the resolution results, it returns the IP addresses corresponding to the website
- The browser initiates an access request to receive content from the server
- The server delivers the content requested by the browser
However, there is a more complicated process in the 6th and 7th steps.

The role of the physical layer is to realize the physical transmission of bit travel between adjacent nodes and to shield the differences between transmission media and physical devices as much as possible. The IP datagrams are assembled into frames and transmitted on the link between the 2 adjacent nodes. Gateways (routers) serve as an entry and exit point for a network as all IP datagrams must pass through or communicate with the gateway prior to being routed. So, the website server exits through the public network and then passes through the backbone network, and then connects to the local area network where the user is located through its modem, and finally, the user can browse the website.


However, the transmission of the backbone network is the most time-consuming. If a large amount of data is transmitted and a large number of users access the website, there will be a long delay, that affects the user experience. Every request for data requires a troublesome data transmission, that affects the user experience.
For example, when you access a social-media, there must be thousands of pictures on the website. What if there may be 1 million persons requesting the same picture at the same time? There will be 1 million data transmissions, which is challenging to the network infrastructure.
So, CDN technology is used to avoid this issue.

It can store data in the node closest to the user in advance, so as to reduce the burden on the network backbone and improve the access speed.
When the browser sends a request, it looks up from the CDN cache server. If it can obtain the data, then return it directly. Otherwise, it will go through the backbone network to obtain the data from the website server. As long as the data is uploaded to the CDN cache server in advance, it can greatly reduce network traffic and network latency.
Users can come from all over the world. In order to reduce the transmission delay, the CDN cache server is set up near users based on the category of location. For example, London, New York, Beijing, Shanghai, etc. So that, users in various regions can request to the corresponding CDN server.
Elements
- Distributed Storage
- Load balancing
- Network request redirection
- Content management
- Network traffic management
Content management and network traffic management are the core of CDN. CDNs ensure that data content is delivered in an extremely efficient manner.
CDN Architecture

CDN cache is divided into 2 layers. The ratio of L1 and L2 is allocated reasonably.
The process:
- Users search for the data content and check if the cached data content is on the local devices. If there is cached data content locally on the client side, the data content is delivered directly.
- If there is no cached data content locally, it accesses the source data from CDN L1. If L1 has cached data content, it is delivered to the client's local disk to cache it locally.
- If there is no cached data content from CDN L1, it accesses the source data from CDN L2. If L2 has cached data content, it is delivered to the CDN L1 and local disk to cache the data content
- If there is no cached data content from CDN L2, it accesses the source data from the original server. The encoding and decoding process will be executed to return the data that the client can support. Then, CDN L1, CDN L2, and the local disk cache the data content.
Features
- It improves the access speed of the websites
- It eliminates the impact caused by the bottleneck of interconnection between different operators, realizes network acceleration across operators, and ensures that users in different networks can get good access speed
- The cache server is automatically selected according to the DNS load balancing technology
- Bandwidth optimization
Key technologies in CDN
- Content routing — Redirection (DNS) mechanism across multiple remote service points (POPs)
- Content publishing — It publishes or delivers content to the remote service point (POP) closest to the user (indexing, caching, stream splitting, or multicasting)
- Content exchange — It intelligently balances load traffic on the POP cache server using application layer switching, stream splitting, and redirection (ICP, WCCP) based on the availability of content, server availability, and user category
- Performance management — It obtains status information of network components through internal and external monitoring systems (data: packet loss, transmission delay, average bandwidth, startup time, frame rate, etc) in optimum operating condition
References






