![]() Because this is a resize request, it is forwards a short-lived S3 URL to Imgproxy. The request falls back to the Storage server.If the image has never been accessed, it is a “Cache miss”. The Gateway tries to find a cached object in our CDN using the Cache Key. Inside the image metadata is a Cache Key - this is comprised of an Etag + tenant ID + bucketname + image name.This gateway reads the image metadata from a global KV store (this metadata is created when the image was uploaded). The request hits our globally-distributed API Gateway. ![]() Let's imagine one of your users makes a request for a resized cat (kitten?) image in your application. Cache refresh: an image is updated/deleted and the CDN needs to be updated.Cache hit: the image has been resized and is stored in the cache.Cache miss: the image has never been resized.Let's step through a few different flows to see how it all works: This allows them to scale independently depending on your workload. As a result, we kept the image resizer and the Storage API as two separate containers. This means that there are different scaling requirements for every developer. ![]() Some developers have a high “resize” workload, and some have a high “read” workload. Let's put everything together to see how the new Smart CDN works with Imgproxy. ObjectUpdated:Metadata # An object's metadata is updated Smart CDN Deep Dive It's as simple as enabling a few environment variables. If you're self-hosting then you can use them today. We haven't exposed these parameters on our platform yet, but they are coming soon. Webhooks + Rate-limitingĪs a “pre-release”, we've added webhooks and rate-limiting to the Storage API. If you're interested in how the cache works, see the deep-dive later in this blog post. Whenever you update or delete an image, the cache will be busted within 60 seconds - for every region in the world.Īs a developer, you no longer need to worry about adjusting your cache parameters - the cache “just works”. With this release we're introducing a Smart CDN. Similarly for deleted images - the cache will continue serving the deleted image until the cache expires. If you update an image in S3, users will continue to see the old, stale image for one hour. This approach introduces the possibility of a “stale” image. This parameter is configurable (for example, you can make it one day, or one year). After this header expires, we re-check the origin (S3), to see if an image is still available. Our Basic CDN works by adding a 1-hour cache header to every request. We already provide a “basic” CDN for all projects (including Free-plan), so the important update here is some smarter cache invalidation whenever there are changes. Resizing images can get expensive, so before this release we knew we needed a better caching system. While in Beta, it is only enabled for Pro-plan and Enterprise customers. We support the contain, cover and fill modes.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |