How CloudFront Works with Regional Edge Caches
CloudFront Regional Edge Caches bring more of your content closer to your viewers, even when the content is not popular enough to stay at a CloudFront edge location. This helps improve performance for your viewers, while lowering the operational burden and cost of scaling your origin resources.
This feature helps with all types of content, particularly content that tends to become less popular over time. Examples include user-generated content, such as video, photos, or artwork; e-commerce assets such as product photos and videos; and news and event-related content that might suddenly find new popularity.
How Regional Caches Work
Regional Edge Caches are CloudFront locations that are deployed globally, at close proximity to your viewers. These locations sit between your origin webserver and the global edge locations that serve traffic directly to your viewers. As the popularity of your objects reduce, individual edge locations may evict those objects to make room for more popular content. Regional Edge Caches have larger cache width than any individual edge location, so your objects remain in cache longer at the nearest regional edge cache location. This helps keep more of your content closer to your viewers, reducing the need for CloudFront to go back to your origin webserver, and improving overall performance for viewers.
When a viewer makes a request by your website or application, DNS routes the request to the CloudFront edge location that can best serve the user’s request. This location is typically the nearest CloudFront edge location in terms of latency. In the edge location, CloudFront checks its cache for the requested files. If the files are in the cache, CloudFront returns them to the user. If the files are not in the cache, the edge servers go to the nearest Regional Edge Cache to fetch the object. In the Regional Edge Cache location, CloudFront again checks its cache for the requested files. If the files are in the cache, CloudFront forwards the files to the requested edge location. As soon as the first byte arrives from Regional Edge Cache location, CloudFront begins to forward the files to the user. CloudFront also adds the files to the cache in the requested edge location for the next time someone requests those files.
For files not cached at both the edge location and the Regional Edge Cache location, CloudFront compares the request with the specifications in your distributions and forwards the request for your files to the applicable origin webserver. Once your origin webservers sends the files back to the Regional Edge Cache location, they are forwarded to the requested edge location, and CloudFront forwards the files to the user. In this case, CloudFront also adds the files to the cache in the Regional Edge Cache location in addition to the edge location for the next time a viewer requests those files. Now, all edge locations in a region now share a local cache, eliminating multiple requests to your origin webserver. Additionally, CloudFront keeps persistent connections with your origin webservers so that those files are fetched from the origin servers as quickly as possible.
You do not need to make any changes to your CloudFront distributions. Regional edge caches are enabled by default for all CloudFront distributions.
There is no additional cost for using this feature.
Regional Edge Caches have feature parity with edge locations. For example, a cache invalidation request removes an object from both edge caches and Regional Edge Caches before it expires. The next time a viewer requests the object, CloudFront returns to the origin to fetch the latest version of the object.
Regional Edge Caches are available for custom origins. Amazon S3 origins are not supported.
PUT/POST/PATCH/OPTIONS/DELETEflow directly to the origin from the edge locations and do not proxy through the Regional Edge Caches.
Dynamic content as determined at request time (cache-behavior configured to forward all headers) does not flow through the Regional Edge Caches, but goes directly to the origin.
You can measure the performance improvements from this feature by using cache-hit ratio metrics available on the console. To learn more about cache-hit ratio metrics, see CloudFront Cache Statistics Reports.