Large media Service: Transformed images in cache?

Hello Netlify,

I’m using the large-media service and image transformation features.

These 2 features work as expected but recently, I’ve checked my usage and I’ve noticed my count of image transformations was quite high for such a little traffic (my site is not yet “live” and i’m the only one accessing it for now).

The netlify documentation saying “Transformed images are cached for faster performance and reduced transformation count”, so I’m wondering if I am really accessing the transformed images in cache or if the images already transformed in the past are once again transformed before being served.
Is there a way to know this?

Does a build can invalidate the cache of transformed images?

Thanks for your answer.

Stephanie

Hi, @stephanie-w, I’m getting clarification on how transformations are calculated and when transformations can be expected to occur. Once I have those details, I’ll follow-up with you here (and, hopefully, this will happen tomorrow).

Hello again, @stephanie-w.

I’ve found more information about the transformation counting.

A transformation happens each time a request is made for an image with transformations options and then it will be cached for approximately 30 days (the length of the billing period).

For example, let’s say a request is made for apple.jpg with a smartcrop transform of 100x100. This won’t be counted as a transform again unless one of the following occurs:

  • the content of the file apple.jpg changes in the repo and a new deploy occurs
  • a new (previously uncached) transformation occurs - example: changing to smartcrop 200x200
  • the caching lifetime passes (a new billing cycle)

If there are other questions about this, we’ll be happy to answer so, if questions remain, please let us know.

1 Like

Hello Luke,

Thanks for your enlightenments. It really helps to understand how it works.

Yet, there is one last piece of information i’m missing so i can get the all picture: How often the transformation count is refreshed, every day, every hour?
It would be nice if you’ll find out and let me know.

Thanks again.
Stephanie

I think it is probably refreshed about once a day. We are working to improve the update frequency, but for now that’s what you should anticipate.

Hello Luke,

I’m looking at the counter and is still growing very fast.
I don’t mind subscribing to the level 1 plan for image transformations because this service is very convenient for me but i want to be sure it fits the need of a site with lazy-loaded and responsive images and that i correctly understand your second point :

  • a new (previously uncached) transformation occurs - example: changing to smartcrop 200x200

This is what i’ve understood:
Let say i’m on my mobile and i’m on a page with an image lazyloaded at 100px, then displayed at 760px. The two transormations are counted and 100px and 760px are now in the cache.
Then on my desktop, i access the same page, the image is lazyloaded at 100px then displayed at 1024px. So 3 new transformations are counted for 100px, 760px and 1024px that are now in the cache until the next “unseen” transformation.
And at some point, since there is 4 or 5 different sizes available for a responsive image, I can expect all the different sizes to be on the cache and the count to be stabilised.
Right?

Or do you just mean there can only be one transformation available at a time in the cache for a given image?

PS: it would be nice to have this info in the doc :slight_smile:

Hi, @stephanie-w, your understanding is correct. Meaning, yes to this:

And at some point, since there is 4 or 5 different sizes available for a responsive image, I can expect all the different sizes to be on the cache and the count to be stabilised.
Right?

The only thing I would add is that this counter resets each billing cycle (as the images are not cached forever - only for the billing cycle).

This means, if your billing is synced to the month, if you were load the 100px on May 31st and then again on June 1st, then it will count as a new transform on June 1st. Again, the transform count would also have been reset to zero when this happens though.

Regarding adding this to our documentation, thank you for this suggestions. I’ll take this up with our Docs team.

I confirm the transformation counter is now stable since a couple of days.
Thanks

1 Like