Q25 — AWS SAP-C02 Ch.3
Question 25 of 75 | ← Chapter 3
Q250. A company has a complex web application that leverages Amazon CloudFront for global scalability and performance. Over time, users report that the web application is slowing down. The company's operations team reports that the CloudFront cache hit ratio has been dropping steadily. The cache metrics report indicates that query strings on some URLS are inconsistently ordered and are specified sometimes in mixed case letters and sometimes in lowercase letters. Which set of actions should the solutions architect take to increase the cache hit ratio as quickly as possible?
- A. Deploy a Lambda@Edge function to sort parameters by name and force them to be lowercase. Select the CloudFront viewer request trigger to invoke the function. ✓
- B. Update the CloudF ront distribution to disable caching based on query string parameters.
- C. Deploy a reverse proxy after the load balancer to post process the emitted URLs in the application to force the URL strings to be lowercase.
- D. Update the CloudFront distribution to specify casing-insensitive query string processing.
Correct Answer: A. Deploy a Lambda@Edge function to sort parameters by name and force them to be lowercase. Select the CloudFront viewer request trigger to invoke the function.
Explanation
Option A would be the best set of actions to take to increase the cache hit ratio as quickly as possible. The solution involves deploying a Lambda@Edge function that will sort the parameters by name and force them to be lowercase. This will ensure that all queries are consistent and can be cached effectively by CloudFront. The function can be triggered using the CloudFront viewer request trigger, which ensures that it runs on every request and sorts the query strings appropriately. Option B is not an ideal solution since it involves disabling caching based on query string parameters. This will result in a decrease in performance and increased latency since CloudFront will no longer cache responses that include query strings. Option C involves deploying a reverse proxy after the load balancer to modify the URLs emitted by the application to be lowercase. This option requires significant changes to the application and additional infrastructure, which may not be feasible or practical. Option D involves updating the CloudFront distribution to specify casing-insensitive query string processing. However, this option does not resolve the inconsistency in parameter order and case sensitivity. It only allows CloudFront to consider the same query parameters regardless of their letter cases. Before CloudFront serves content from the cache it will trigger any Lambda function associated with the Viewer Request, in which we can normalize parameters.