DEV Community

Discussion on: Serverless cache

Collapse
 
ymwjbxxq profile image
Daniele Frasca AWS Community Builders

Hey Marius,

I think it is a similar setup with an extra cost for the Origin Shield.
The first time I need to go up to the origin, so up to DynamoDB.
The value would be cached into CloudFront.

I was looking at Origin Shield but could not find a way to see an improvement. What are your thoughts? How would you use it?

Collapse
 
selul profile image
Marius Cristea

I was thinking that could be used instead of saving the cached data in DynamoDB, the only downside I think is that you would be limited to one region vs DynamoDB which can assure multi-region support.

Thread Thread
 
ymwjbxxq profile image
Daniele Frasca AWS Community Builders

Actually could work out.

Viewer requests are routed first to a nearby CloudFront edge location, and if the object isn’t cached in that location, the request is sent on to a regional edge cache.

When viewers are in different geographical regions, requests can be routed through different regional edge caches, each of which can send a request to your origin for the same content. But with Origin Shield, you get an additional layer of caching between the regional edge caches and your origin. All requests from all regional edge caches go through Origin Shield, further reducing the load on your origin.

If I got it right would be:

If I request A from region1, this is cached in the regional cache of region1.

If you request A from region2, this will hit the origin because not present in your regional cache.

Adding Origin Cache will not hit the origin.

Thread Thread
 
selul profile image
Marius Cristea

Yes, that's what I was thinking about.