avatarJIN

Summary

Content Delivery Network (CDN) is a geographically distributed network of servers that improves the performance and availability of web content by reducing the physical distance between the user and the server.

Abstract

Content Delivery Network (CDN) is a system that stores and delivers content to users based on their geographic location. This is achieved by distributing servers across multiple locations and directing users to the server that is closest to them. CDN addresses the issues of network latency and bandwidth consumption by reducing the physical distance between the user and the server. It also eliminates the impact of bottlenecks caused by interconnection between different operators and ensures good access speed for users in different networks.

Opinions

  • The author emphasizes the importance of CDN in improving the access speed of websites and reducing network latency.
  • The author highlights the role of CDN in eliminating the impact of bottlenecks caused by interconnection between different operators.
  • The author explains the technical principle of CDN and how it works to improve network performance.
  • The author discusses the key technologies in CDN, including content routing, content publishing, content exchange, and performance management.
  • The author provides references to further resources for readers who want to learn more about CDN.
  • The author encourages readers to support their work by using the provided links to Patreon, Ko-fi, and Buy Me a Coffee.
  • The author promotes their course on system design and coding interviews, offering unlimited access to all future updates free of cost.
Photo by Patrick Tomasso on Unsplash

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.

Image credit: Vercel, Inc

Technical Principle

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

Image Credit: Digital Communications and Networks
  1. Users type the domain name in the browser URL bar to initiate a request to a designated server
  2. The browser requests the resolution of the websites from the local DNS server
  3. 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
  4. 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
  5. After the browser obtains the resolution results, it returns the IP addresses corresponding to the website
  6. The browser initiates an access request to receive content from the server
  7. The server delivers the content requested by the browser

However, there is a more complicated process in the 6th and 7th steps.

Image Credit: The impact of the General Data Protection Regulation on internet interconnection

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.

Image Credit: krishna_97 on Geeksforgeeks
Image Credit: Cybertelecom

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.

Image Credit: Cybertelecom

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

  1. Distributed Storage
  2. Load balancing
  3. Network request redirection
  4. Content management
  5. 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

Image Credit: Hossein Ashtari on Spiceworks

CDN cache is divided into 2 layers. The ratio of L1 and L2 is allocated reasonably.

The process:

  1. 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.
  2. 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.
  3. 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
  4. 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

  1. It improves the access speed of the websites
  2. 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
  3. The cache server is automatically selected according to the DNS load balancing technology
  4. Bandwidth optimization

Key technologies in CDN

  1. Content routing — Redirection (DNS) mechanism across multiple remote service points (POPs)
  2. Content publishing — It publishes or delivers content to the remote service point (POP) closest to the user (indexing, caching, stream splitting, or multicasting)
  3. 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
  4. 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

If you’ve found any of my articles helpful or useful then please consider throwing a coffee my way to help support my work or give me patronage😊, by using

Patreon

Ko-fi.com

buymeacoffee

Last but not least, if you are not a Medium Member yet and plan to become one, I kindly ask you to do so using the following link. I will receive a portion of your membership fee at no additional cost to you.

It is my first affiliate program, if you like to further enhance your system knowledge, you can click the links and buy the course. Honestly speaking, I will receive 20% of your course fees at no additional cost to you. You will have unlimited access to our courses. There is no time expiry and you will have access to all future updates free of cost.

Sign up for our Free Weekly Newsletter. Fresh content from developers all over the world, fresh and direct from the field! Don’t forget to follow our publication The Dev Project.

Content Delivery Network
Network
Software Development
System Design Interview
Cache
Recommended from ReadMedium