CDNとは
その仕組みは

インターネットの3大問題、遅い・止まる・利用できないを解決

CDNとは、コンテンツ・デリバリ・ネットワークの略で、世界中に張り巡らされたCDN専用の配信ネットワーク(CDNプラットフォーム)を利用して、Webサイトにアクセスしようとするエンドユーザに最も近いPoP(配信拠点)から効率的かつ高速にWebを配信する仕組みです。

ユーザへのコンテンツ配信に依存度の高いビジネスにとってCDNの利用は役立ちます。

例えば以下のようなケースです。

  • 世界中に読者がいるメジャーなメディアサイト
  • ユーザのフィードにマルチメディアコンテンツを配信するソーシャルメディアサイト
  • 高解像度のWebコンテンツをリアルタイムで配信するNetflixのようなエンターテインメントWebサイト
  • 数百万の顧客を抱えるEコマースプラットフォーム
  • 世界中に分散したユーザがアクセスするグラフィックを多用したコンテンツを持つゲーム会社

これらの企業は、コンテンツ配信の高速化、サービスの可用性、リソースの拡張性、そしてWebアプリケーションのセキュリティを確保しなければなりません。これらはすべて、CDNの利用により解決できます。

CDNの歴史

CDNは、インターネット上のユーザに大量のデータを高速配信するという課題に対処するために、約20年前に誕生しました。今日では、CDNはWebサイトのコンテンツ配信の原動力となり、学術機関や商用開発者によって研究され、アップデートされ続けています。

最初のCDNは90年代後半に構築され、現在でも世界のインターネットトラフィックの15~30%を占めています。その後、ブロードバンドコンテンツの成長と、インターネット上でのオーディオ、動画、および関連データのストリーミングが増加し、より多くのCDNが開発されるようになりました。大まかに言えば、CDNの進化は4つの世代に分類できます。

01 事前形成期:CDNが実際に作られる前は、必要とされる技術やインフラが開発されていました。この時期は、サーバファームの台頭、階層型キャッシング、Webサーバの改良、キャッシュプロキシの展開などが特徴的でした。ミラーリング、キャッシング、マルチホーミングもまた、CDNの開発と成長への道を切り開いたテクノロジーでした。

02 第1世代: CDN の第一世代は、主に動的および静的コンテンツ配信に焦点を当てていました。これは、当時はWeb上には2つのコンテンツタイプのみであったためです。主要なメカニズムは、レプリカの作成と実装、インテリジェントルーティング、およびエッジコンピューティングの手法でした。そして、アプリや情報はサーバに分散されていました。

03 第2世代:次に登場したのは、動画やオーディオコンテンツのストリーミングや、Netflix のようなビデオ・オン・デマンドのサービスをユーザやニュースポータルに提供することに焦点を当てた CDN です。この世代はまた、Webサイトのコンテンツをモバイルユーザに配信するための道を切り開き、P2Pやクラウド・コンピューティングの技術を利用するようになりました。

04 第3世代:第三世代のCDNは、私たちが現在、新しい研究開発で進化し続けている場所です。将来的にCDNは、コミュニティ向けによりモデル化されていくことが予想されます。つまり、システムは平均的なユーザと一般の個人によって駆動されることになります。セルフ管理や自律的なコンテンツ配信と同様に、セルフ設定が新しい技術メカニズムとなることが期待されています。エンドユーザの体験の質が、今後の主要な推進力になると予想されます。

CDNは当初、CDNサービスプロバイダの数とともに動画ストリーミングの需要が高まっていたため、極端な帯域幅のプレッシャーに対処するために進化しました。世代ごとの接続性の進歩と新しい消費動向により、CDNサービスの価格は下落し、マス市場向けの技術となりました。また、クラウド・コンピューティングの普及により、CDNはビジネスのあらゆるレイヤで重要な役割を果たしています。 これは、SaaS(Software as a service:ソフトウェアサービス)、IaaS(Infrastructure as a service:インフラサービス)、PaaS(Platform as a service:プラットフォームサービス)、BPaaS(Business Process as a service:ビジネスプロセスサービス)などのモデルの鍵となります。

CDNの仕組み

CDNは、ユーザとWebサーバ(以下、オリジン)間の物理的な距離を縮めることで効果を発揮する仕組みです。 一般に、インターネット上でWebサイトを運営する場合、お客様は配信元となるオリジンをたて、そこへエンドユーザを誘導する形でコンテンツの配信を行います。しかし、突発的にアクセスが増えるとオリジンがダウンしてしまうことや、海外からアクセスしようとするとWebページの表示に時間がかかってしまうことがあります。

これを避けるため、グローバルに事業を展開しているCDNプロバイダは、PoPを世界中に設置し、そこに多数のWebサーバ(以下、CDNサーバ)を配置してCDNプラットフォームを構築しています。それぞれのCDNサーバには、オリジンから取得したコンテンツをキャッシュ(コピー)しておき、アクセスしてきたエンドユーザそれぞれに最も近いCDNサーバがこれに応答することで、高速で安定した配信環境が保たれます。

CDNを利用しない場合

When a user enters the website into the browser, he establishes a connection similar to the one in the following figure. The website name resolves to an IP address using the Local DNS or LDNS (such as the DNS server provided by the ISP or a public DNS resolution server). If the DNS or LDNS cannot resolve the IP address, it recursively asks upstream DNS servers for resolution. Ultimately, the request may pass to the authoritative DNS server where the zone is hosted. This DNS server resolves the address and returns it to the user.

Local DNS to Authoritative DNS

Then the user’s browser directly connects to the origin and downloads the website content. Each subsequent request is served by the origin directly, and the static assets are cached locally on the user’s machine. If another user from a similar or other location tries to access the same site, he will go through the same sequence. Every time, user requests will hit the origin and the origin will reply with content. Each step along the way adds a delay, or “latency”. If the origin is located far from the user, response times will suffer from significant latency, delivering a poor user experience.

CDNを利用する場合

In the presence of a CDN however, the process is slightly different. When the user-initiated DNS requests are received by his LDNS, it forwards the requests to one of the CDN’s DNS servers. These servers are part of the Global Server Load Balancer infrastructure (or “GSLB”). The GSLB helps with load balancing functionality that literally measures the entire Internet, and keeps tracking information about all available resources and their performance. With this knowledge, the GSLB resolves the DNS request using the best performing edge address (usually in proximity to the user). An “edge” is a set of servers that caches and delivers the web content.

Global Service Load Balancer Diagram

After DNS resolution is completed, the user makes the HTTPS request to the edge. When the edge receives the request, the GSLB servers help the edge servers forward the requests following the optimal route to the origin. Then the edge servers fetch the requested data, delivers it to the end-user who requested it, and stores that data locally. All subsequent user requests will be served from the local dataset without having to query the origin server again. Content stored on the edge can be delivered even if the origin becomes unavailable for any reason.

なぜCDNを利用するのか

CDNs help businesses deliver content to end users effectively by minimizing latency, improving website performance and reducing bandwidth costs.

Another unique feature of CDNs is that it allows the edge servers to prefetch content in advance. This ensures that the data you are going to deliver is stored in all CDN data centers. In CDN parlance, these data centers are called Points of Presence (or “POPs”). PoPs help minimize the round-trip time by bringing the web content closer to the website visitor.

For example, assume that you run an ad campaign and advertise your service or product among millions of potential customers. You may expect a large number of customers to rush to your site after reading the post. If you deal with influencers who have good audience engagement rates, the volume of traffic can see an even bigger spike. Can you be sure that your origin server will be able to handle this spike in volume all at once?

In such a scenario, CDNs can help distribute the load between the edge servers, and everyone will get the response. Because only a small fraction of requests will reach the origin, your servers will not experience massive traffic spikes, 502 errors, and overloaded upstream network channels.

CDNを利用するメリット

Depending on the size and needs of your business, the benefits of CDNs can be broken down into 4 different components:

Webサイトページの読み込み速度の改善
By enabling web content distribution closer to website visitors by using a nearby CDN server (among other optimizations), visitors experience faster webpage loading times. Visitors are usually more inclined to click or bounce away from a website with a high page load time. This can also negatively affect the webpage’s ranking on search engines. So having a CDN can reduce bounce rates and increase the amount of time that people spend on the site. In other words, a website that loads quickly will keep more visitors around longer.

帯域幅コストの削減
Every time an origin server responds to a request, bandwidth is consumed. The costs of bandwidth consumption is a major expense for businesses. Through caching and other optimizations, CDNs are able to reduce the amount of data an origin server must provide, thus reducing hosting costs for website owners.

コンテンツの可用性と冗長性の向上
Large amounts of web traffic or hardware failures can interrupt normal website function and lead to downtime. Thanks to their distributed nature, a CDN can handle more web traffic and withstand hardware failure better than many origin servers. Moreover, if one or more of the CDN servers go offline for some reason, other operational servers can pick up the web traffic and keep the service uninterrupted.

Webサイトのセキュリティの向上
The same process by which CDNs handle traffic spikes makes it ideal for mitigating DDoS attacks. These are attacks where malicious actors overwhelm your application or origin servers by sending a massive amount of requests. When the server goes down due to the volume, the downtime can affect the website’s availability for customers. A CDN essentially acts as a DDoS protection and mitigation platform with the GSLB and edge servers distributing the load equally across the entire capacity of the network. CDNs can also provide certificate management and automatic certificate generation and renewal.

CDNは他にどのように役立つか

The CDN is not limited to the benefits explained above. A modern CDN platform delivers many more advantages to your business and engineering teams.

It can be used to manage access from different regions on the planet. While you allow access for some regions, you can deny access to others.

You can easily offload application logic to the edge and close to your customers. You can process and transform the request/response headers and body, route requests between different origins based on request attributes, or delegate authentication tasks to the edge.

Large amounts of traffic require an infrastructure for log collection and processing for further analysis. CDNs collect the logs and provide an interface to conveniently analyze the data generated by the visitors.

It is only natural that something becomes easy to use when you are already familiar with it. For that reason, CDN360 edges are NGINX based. This means you can perform tasks using standard NGINX directives.

Our engineering team spent thousands of hours extending NGINX.

データセキュリティとCDN

Information security is an integral part of a CDN. CDNs help protect a website’s data in the following ways.

TLS/SSL証明書の提供

CDN can help protect a site by providing Transport Layer Security (TLS)/Secure Sockets Layer (SSL) certificates that ensure a high standard of authentication, encryption, and integrity. These are certificates that ensure that certain protocols are followed in the transfer of data between a user and a website.

When data is transferred across the internet, it becomes vulnerable to interception by malicious actors. This is addressed by encrypting the data using a protocol such that only the intended recipient can decode and read the information. TSL and SSL are such protocols that encrypt the data sent over the Internet. It is a more advanced version of Secure Sockets Layer (SSL). You can tell if a website uses the TLS/SSL certification if it starts with https:// rather than http:// , suggesting that it is secure enough for communication between a browser and a server.

DDoS攻撃からの防御

Since the CDN is deployed at the edge of the network, it acts as a virtual high-security fence against attacks on your website and web application. The scattered infrastructure and the on-edge position also makes a CDN ideal for blocking DDoS floods. Since these floods need to be mitigated outside of your core network infrastructure, the CDN will process them on different PoPs according to their origin, preventing server saturation.

Botやクローラーをブロック

CDNs are also capable of blocking threats and limiting abusive bots and crawlers from using up your bandwidth and server resources. This helps limit other spam and hack attacks and keeps your bandwidth costs down.

Webパフォーマンス向上

Static content refers to those assets of yours that do not need to be generated, processed, or modified before they are delivered to end-users. These might be images or other media files, binaries of all sorts, or static parts of your application such as HTML, CSS, JavaScript libraries, or even JSON, HTML, or any kind of dynamic responses that do not change often. You can prefetch such content in advance, as mentioned earlier. Then, when you need to invalidate such content and remove it from edge servers, you can purge the desired paths.

Dynamic acceleration applies to something that cannot be cached on the edge due to its dynamic nature. Imagine a WebSocket application that listens for events from a server or API endpoint whose response differs, depending on credentials, geographic location, or other parameters. It is hard to leverage the cache machinery on the edge in a way that is similar to caching static content. In some cases, tighter integration between the app and the CDN may help; however, in some cases, something other than caching should be used. For dynamic acceleration, CDN’s optimized network infrastructure and advanced request/response routing algorithms are used.

課金モデル:何にお金を払うのか

Conventionally in a CDN, you pay for the traffic consumed by your end-users and the amount of requests. Additionally, HTTPS requests require more computing resources than HTTP requests, which creates more load on the CDN provider equipment. For this reason, you may pay additional costs for HTTPS requests, while HTTP requests are not billed at an additional cost.

As the computation moves to the edge, the CPU becomes an object of billing. Requests might have various processing pipelines and, as result, will require different amounts of CPU time. It is impractical to bill by the requests count; it is more practical to bill by traffic amount + cpu time used.

Who Uses CDN?
CDN is used by businesses of various sizes to optimize their network presence, availability, and provide a superior user experience for customers. A CDN is particularly popular in the following industries:

  • Advertising
  • Digital Publishing
  • Online Video & Audio
  • Gaming CDN
  • Online Education
  • E-Commerce
  • Public Sector
  • Government
  • Financial Services
  • SaaS
Play Video