Có gì thay đổi Google trân trọng giới thiệu tab tài liệu trong Google Docs,…
What is a Cloud CDN and how does it work?
Regardless of what your app or website does, chances are your users are distributed in a variety of locations and not necessarily near your server. This means that requests travel long distances through the public internet, resulting in an inconsistent and sometimes frustrating user experience. That's where Cloud CDN appear!
What is Cloud CDN?
Cloud CDN is a content delivery network that accelerates the delivery of your web and video content by using Google's global edge network to bring content as close to users as possible. As a result, latency, costs, and load on your backend servers are reduced, making it easier to scale to millions of users. Global anycast IP provides a single IP for global reach. It allows Google Cloud automatically routes users to the nearest edge cache and avoids DNS propagation delays that can impact availability. It supports end-to-end HTTP/2 and the client-to-cache QUIC protocol. QUIC is a method of transporting multiplexed streams over UDP, which reduces latency and is ideal for lossy mobile networks.
How does Cloud CDN work?
Let's look at an example to understand how Cloud CDN works:
-
- When a user makes a request for your website or app, the request is routed to Google edge node closest (we have over 120 of these) for fast and reliable traffic flow. From there, the request is routed to the Global HTTPS Load Balancer to the backend or origin.
- With Cloud CDN enabled, content is served directly from cache – a group of servers that store and manage the cacheable content so future requests for that content can be served faster.
- Cached content is a cacheable copy of web content (JavaScript, CSS), images, videos, and other content stored on your origin server.
- Cloud CDN automatically caches this content when you use the recommended “cache mode” to cache all static content. If you need more control, you can direct the Cloud CDN by setting an HTTP header on your response. You can also force all content to be cached; just know that this ignores the “private” (private), “no-store” or “no-cache” (no cache) directives in the Cache response header- Controls.
- When the Cloud CDN receives the request, it searches the cached content using cache key. This is usually a URI, but you can customize the cache key to clear the protocol, server, or query string.
- If a cached response is found in the Cloud CDN cache, the response is retrieved from the cache and sent to the user. This is called a cache hit. When a cache hit occurs, Cloud CDN searches for the content with its cache key and responds directly to the user, shortening round-trip times and reducing load on the origin server.
- A piece of content is requested the first time, Cloud CDN cannot make the request from the cache because it does not have that piece of content in the cache. This is called a cache error. When a cache failure occurs, the Cloud CDN may try to get content from a nearby cache. If a nearby buffer has content, it sends that content to the first buffer using fill-from-buffer. Otherwise it just sends the request to the origin server.
- The maximum lifetime of objects in the cache is determined by TTLs, or lifetime values, set by the cache directive for each HTTP response or cache mode. When the TTL expires, the content is removed from the cache.
How to use Cloud CDN
You can set up Cloud CDN through gCloud CLI, Cloud Console or API. Because Cloud CDN uses Cloud Load Balancing to provide routing support, health checking and anycast IP, it can be enabled by selecting a checkbox easily while setting up your backend or origin.
Cloud CDN makes it easy to serve web and media content using Google Cloud Storage. You simply upload your assets to your Cloud Storage bucket, set up your Load Balancer, and enable caching. To enable hybrid architectures that span the clouds and on-premises, Cloud CDN and HTTP(S) Load Balancing also support external backends.
Security
- Data is encrypted at rest and passed from Cloud Load Balancing to the backend for end-to-end encryption.
- You can programmatically sign URLs and cookies to limit video segment access to authorized users. The signature is validated at the CDN edge and unauthorized requests are blocked right there!
- On a broader level, you can enable free SSL using a certificate managed by Google!
For an in-depth look at Cloud CDN, check out document.
Source: Gimasys