You are using Cloud CDN to deliver static HTTP(S) website content hosted on a Compute Engine instance group. You want to improve the cache hit ratio. What should you do?
A.
Customize the cache keys to omit the protocol from the key.
B.
Shorten the expiration time of the cached objects.
C.
Make sure the HTTP(S) header ג€Cache-Regionג€ points to the closest region of your users.
D.
Replicate the static content in a Cloud Storage bucket. Point CloudCDN toward a load balancer on that bucket.
A, for sure.
By default, Cloud CDN uses the complete request URL to build the cache key. For performance and scalability, it’s important to optimize cache hit ratio. To help optimize your cache hit ratio, you can use custom cache keys .....
Cache Keys and Protocols: Cloud CDN uses cache keys to identify and store content in its cache. By default, the protocol (HTTP or HTTPS) is included in the cache key. This means that the same content served over HTTP and HTTPS will be cached separately, reducing the cache hit ratio.
Omitting the Protocol: Customizing the cache keys to omit the protocol allows Cloud CDN to treat HTTP and HTTPS requests for the same content as identical. This increases the chance of a cache hit, as the CDN can serve the cached content regardless of the protocol used in the request.
Improved Cache Hit Ratio: By consolidating the cache entries for HTTP and HTTPS versions of the content, you effectively increase the cache hit ratio. This leads to better performance, reduced latency, and lower costs.
A and D could be OK but there is no information in the question that both http and https protocols are used (it is in fact not probable to use both protocols). Anwer A would be only valid when both http and https are in use.
Incorrect, respectfully. "HTTP(S)" (the parenthesis) implies that HTTP requests can be made using *either* HTTP or HTTPS, especially if TLS is not mandatory. If a site returns a 200 OK for http://www.example.com/picture/of/a/cat.jpg and httpS://www.example.come/picture/of/a/cat.jpg, then you should exclude the protocol in the cache key to increase the cache-hit ratio. If you don't, the CDN will treat both URLs as different objects.
Replicating static content in a Cloud Storage bucket and pointing CloudCDN toward a load balancer on that bucket may improve the distribution of content but is not directly related to improving the cache hit ratio based on the customizing of cache keys.
D
This option is the best because Cloud Storage has built-in caching and can serve content faster than Compute Engine instances. It also allows for better scalability and availability. By pointing Cloud CDN towards a load balancer on the Cloud Storage bucket, the cache hit ratio can be improved as the content will be served directly from the cache without needing to access the Compute Engine instances.
Option A (Customize the cache keys to omit the protocol from the key) may not be effective in improving the cache hit ratio as it only removes the protocol from the cache key and does not address the underlying issue of slow content delivery.
Customizing the cache keys by omitting the protocol from the key (option A) can be a valid approach to improve the cache hit ratio for CDN delivered Compute Engine, but it may not be the most effective solution for all cases.
Customizing the cache keys can improve the cache hit ratio by reducing the number of cache misses caused by variations in the request URL, headers, and parameters. However, customizing the cache keys requires careful consideration of the caching policies, traffic patterns, and content types
A. Customize the cache keys to omit the protocol from the key.
To improve the cache hit ratio with Cloud CDN, you should customize the cache keys to omit the protocol (e.g. HTTP or HTTPS) from the key. This will allow Cloud CDN to cache the same content under both HTTP and HTTPS, which can help to improve the hit ratio by allowing Cloud CDN to serve content from cache more frequently.
To customize the cache keys, you can use the --key-include-protocol flag when enabling Cloud CDN for your Compute Engine instance group or load balancer. Setting this flag to false will cause Cloud CDN to omit the protocol from the cache key.
Other options, such as shortening the expiration time of cached objects or replicating content in Cloud Storage, may also help to improve the cache hit ratio, but customizing the cache keys to omit the protocol is likely to have the greatest impact.
Each cache entry in a Cloud CDN cache is identified by a cache key. When a request comes into the cache, the cache converts the URI of the request into a cache key, and then compares it with keys of cached entries. If it finds a match, the cache returns the object associated with that key.
Use case:
"A logo needs to be cached whether displayed through HTTP or HTTPS. When you customize the cache keys for the backend service that holds the logo, clear the Protocol checkbox so that requests through HTTP and HTTPS count as matches for the logo's cache entry."
https://cloud.google.com/cdn/docs/best-practices#using_custom_cache_keys_to_improve_cache_hit_ratio
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
shandy
Highly Voted 4 years, 11 months agotartar
4 years, 3 months agokumarp6
4 years agonitinz
3 years, 8 months agoMestreCholas
1 year, 8 months agogfhbox0083
Highly Voted 4 years, 5 months agoEkramy_Elnaggar
Most Recent 1 day, 15 hours agonareshthumma
4 weeks agoPrajjwal199831
9 months agoJB28
9 months, 1 week agoPime13
9 months, 3 weeks agobargou
9 months, 3 weeks agoAdityaGupta
1 year, 1 month agoGregwaw
1 year, 1 month agoMikeH20
11 months, 3 weeks agoheretolearnazure
1 year, 2 months agodaidaidai
1 year, 3 months agoVarunGo
1 year, 6 months agoDeb2293
1 year, 8 months agoomermahgoub
1 year, 11 months agoAzureDP900
2 years, 1 month agoAzureDP900
2 years, 1 month agoaut0pil0t
2 years, 2 months ago