A client is using an old version of Umbraco (7.2.8) and they are experiencing a problem with extreme caching of image files in the \App_Data\cache folder.
ImageProcessor seems to be the cause of the problem - and despite various attempts to control its caching, we have not been successful.
We therefore need to be able to either:
1) somehow limit the files being cached, or
2) deactivate the image caching all together.
And no - it is not an option to migrate to a newer version of Umbraco right now, so we need a solution within the context of Umbraco 7.2.8.
Therefore - are there any e.g. config file adjustments og 'umbracoSettings' changes that can be implemented to accommodate this? Please note, that it must work under 7.2.8, and it seems like the options to control the behavior of ImageProcessor are quite limited in that version.
you can see \config\imageprocessor\cache.config to configure cache for ImageProcessor, in worst case if you can develope you own provider or make offline process to clean folder ~/app_data/cache every X time ...
Thank you for your input. However, it is not that easy, unfortunately. There was no \imageprocessor\cache.config file in the project that could be altered to begin with.
Earlier in the process of trying to resolve the issue, we attempted to add it (i.e. the cache.config) and added different entries in the file to to prevent, or minimize, the caching but to no avail - it didn't change anything in version 7.2.8.
Can you explain a scenario where extreme caching comes into play?
eg do you upload an image, it is requested at certain width and height?
subsequent requests of the resized image are then served from the image processor cache??
do you find then if the image is replaced with a different image in Umbraco and it has the same name that the old image is served from the cache??
and if you request the image with different ad-hoc dimensions you get the new image?
It's hard to think back to 7.2.8 days, but if you append a hash of the create date of the image, on the end of the request for the image as a querystring, then, as the querystring is used in the image processor cache, this might resolve the issue in the short term.
There is a setting to say how often an image should stay in Cache for ImageProcessor called 'MaxDays' : github.com/iris-worldwide/ImageProcessor/blob/4fe2230a736e3138942fa8ea3b13526e1f8f49f9/src/ImageProcessor.Web/Configuration/ImageCacheSection.cs#L116
for a V7 site you would set it in /config/imageprocessor/cache.config as an attribute on the
Equally, it is also ok to delete the contents of that folder, on V7 sites I'd do that twice a year to clear up disk space, it does result in all images getting reprocessed again, but is good to do if there has been an Umbraco Upgrade, or ImageProcessor upgrade (you can upgrade ImageProcessor independently of Umbraco version to an extent!)
The caching generally seems to work as expected - but due to the amount of images used on the website, the cache folder quickly fills up, so to speak; hence the 'extreme' expression. :o)
However, we need to limit the caching - and that is the main issue here.
As Yakov mentioned, \imageprocessor\cache.config could be an option - we have just not had any luck with it. What is your experience? does cache.config work under Umbraco 7.2.8? Because it does not seem to have any effect here.
I would definitely prefer an 'out of the box' solution, so if we could get the cache.config 'thing' to work, that would be great.
Yes that configuration and MaxDays setting was available in Umbraco 6, I guess if the site has a lot of images though, even if you delete the whole cache folder, it won't be very long before the images are re-requested and the cache builds up again.
Might be worth checking there aren't any rogue entities in the logs calling your images aggressively with lots of variations of sizes... eg blocking these might reduce the size of the cache generally.
Finally you could look at version 1.2.0 of the UmbracoFileSystemProviders.Azure
Extreme caching of image files
Hi there,
A client is using an old version of Umbraco (7.2.8) and they are experiencing a problem with extreme caching of image files in the \App_Data\cache folder.
ImageProcessor seems to be the cause of the problem - and despite various attempts to control its caching, we have not been successful.
We therefore need to be able to either:
1) somehow limit the files being cached, or
2) deactivate the image caching all together.
And no - it is not an option to migrate to a newer version of Umbraco right now, so we need a solution within the context of Umbraco 7.2.8.
Therefore - are there any e.g. config file adjustments og 'umbracoSettings' changes that can be implemented to accommodate this? Please note, that it must work under 7.2.8, and it seems like the options to control the behavior of ImageProcessor are quite limited in that version.
Any suggestions? Thanks! 🙂
Best, Tom
you can see \config\imageprocessor\cache.config to configure cache for ImageProcessor, in worst case if you can develope you own provider or make offline process to clean folder ~/app_data/cache every X time ...
Hi Yakov,
Thank you for your input. However, it is not that easy, unfortunately. There was no \imageprocessor\cache.config file in the project that could be altered to begin with.
Earlier in the process of trying to resolve the issue, we attempted to add it (i.e. the cache.config) and added different entries in the file to to prevent, or minimize, the caching but to no avail - it didn't change anything in version 7.2.8.
Best, Tom
If I remember correctly, in earlier Umbraco 7 versions, you needed to add ... in web.config.
and add files config\imageprocessor\security.config config\imageprocessor\cache.config config\imageprocessor\processing.config
Thank you, Yakov - I will try this out.
Best, Tom
Hi Tom
Can you explain a scenario where extreme caching comes into play?
eg do you upload an image, it is requested at certain width and height?
subsequent requests of the resized image are then served from the image processor cache??
do you find then if the image is replaced with a different image in Umbraco and it has the same name that the old image is served from the cache??
and if you request the image with different ad-hoc dimensions you get the new image?
It's hard to think back to 7.2.8 days, but if you append a hash of the create date of the image, on the end of the request for the image as a querystring, then, as the querystring is used in the image processor cache, this might resolve the issue in the short term.
There is a setting to say how often an image should stay in Cache for ImageProcessor called 'MaxDays' : github.com/iris-worldwide/ImageProcessor/blob/4fe2230a736e3138942fa8ea3b13526e1f8f49f9/src/ImageProcessor.Web/Configuration/ImageCacheSection.cs#L116 for a V7 site you would set it in /config/imageprocessor/cache.config as an attribute on the
Equally, it is also ok to delete the contents of that folder, on V7 sites I'd do that twice a year to clear up disk space, it does result in all images getting reprocessed again, but is good to do if there has been an Umbraco Upgrade, or ImageProcessor upgrade (you can upgrade ImageProcessor independently of Umbraco version to an extent!)
regards
Marc
Hi Marc,
Thank you for your input.
The caching generally seems to work as expected - but due to the amount of images used on the website, the cache folder quickly fills up, so to speak; hence the 'extreme' expression. :o)
However, we need to limit the caching - and that is the main issue here.
As Yakov mentioned, \imageprocessor\cache.config could be an option - we have just not had any luck with it. What is your experience? does cache.config work under Umbraco 7.2.8? Because it does not seem to have any effect here.
I would definitely prefer an 'out of the box' solution, so if we could get the cache.config 'thing' to work, that would be great.
Best, Tom
Hi Tom
Yes that configuration and MaxDays setting was available in Umbraco 6, I guess if the site has a lot of images though, even if you delete the whole cache folder, it won't be very long before the images are re-requested and the cache builds up again.
Might be worth checking there aren't any rogue entities in the logs calling your images aggressively with lots of variations of sizes... eg blocking these might reduce the size of the cache generally.
Finally you could look at version 1.2.0 of the UmbracoFileSystemProviders.Azure
https://www.nuget.org/packages/UmbracoFileSystemProviders.Azure/1.2.0
this is compatible with Umbraco.7.1.9 upwards...
and would enable you to configure the image cache to be located in Azure Blob Storage
Perhaps even put an Azure CDN over the image requests, once the images are in the CDN you could clear out the disk space!
regards
Marc
Hi Marc,
Thank you for the input - I will look into those options and see if it resolves anything.
Best, Tom
is working on a reply...