Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Adaptive Image & Cache Issue

Avatar

Level 2

Adaptive image component creates following path for the image being used: 
/content/geometrixx-media/en/events/the-lineup-you-ve-been-waiting-for/jcr:content/article-content-par/adaptive_image.adapt.620.high.jpg
Consider following authoring scenarios for a page where 3 adaptive image components have been dropped: 
1.    2 of the images which were dropped on 2 adaptive image components are in the same folder inside /content/dam.
2.    The third one is uploaded from author’s local machine.
Now if I look at the <img src> of all these 3 adaptive image components, these will be
/content/geometrixx-media/en/events/the-lineup-you-ve-been-waiting-for/jcr:content/article-content-par/adaptive_image.adapt.620.high.jpg
/content/geometrixx-media/en/events/the-lineup-you-ve-been-waiting-for/jcr:content/article-content-par/adaptive_image_0.adapt.620.high.jpg
/content/geometrixx-media/en/events/the-lineup-you-ve-been-waiting-for/jcr:content/article-content-par/adaptive_image_1.adapt.620.high.jpg
Which is a big issue since:
1. Same image will be duplicated across all the pages where it was dropped. And there is no clear separation of assets from pages will prevent me optimizing this model further had it been separated.
2. Cache issues- 
•    Generally images are highly static in nature once created so they should have a different TTL than pages which is not possible in this case since my images are getting cached under the page’s jcr:content which gets deleted if we activate that page. If the same image is used across many pages, this would mean getting that images multiple times from CQ.
•    If author updates an image through damadmin which is being used on a page, page will never get flush invalidation and so never know that image was changed since it has the local cache of that image.
•    If author uploads this from local machine this is always getting created under that page node, can we get this created under /content/dam OUT-OF-THE-BOX?
Please let me know how can we solve these before we actually use adaptive image.

1 Accepted Solution

Avatar

Correct answer by
Level 10

I got your question from initial post. Take a look at [1] for details. If you have invalidate section correctly configured then activateing the assets alone should update referenced pages also.  

Having 50 pages referring the same asset. Don;t you thing your implementation design is not appropriate because Authors referencing same image on 50 pages individually....  Solve this issue with  as johan suggested with own adaptive image component OR Update implementation to use shared file OR using boilerplates[2] .

[1]  http://dev.day.com/docs/en/cq/current/deploying/dispatcher.html

[2]   https://dev.day.com/docs/en/cq/current/developing/boilerplates.html

View solution in original post

7 Replies

Avatar

Level 10
  • Agree the dispatcher will cache the adaptive renditions. If you look other angle this takes some load off the publish instance and avoids with more image renditions in publish there by saving disk space, replication time etc...
  • Your cache invalidation concern on page never get flushed is not true might be you misconfigured something.  My first suspect is Make sure to configure [1].
  • Uploading at page level saves under page node only & no OOB option available to store directly under /content/dam . 

[1]   https://helpx.adobe.com/cq/kb/HowToFlushAssetsPublish.html

Avatar

Level 7

Hiya,
for special cache invalidation when it comes to things like DAM assets this is made possible in > CQ5.6
This blogpost describes it a bit more and also provides some examples to solve this for CQ5.5.
http://blog.kristianwright.com/2013/05/28/cq5-gotchya-cache-invalidation-from-publish-agent/

As Sham already pointed out its a great thing to cache the different renditions when it comes to saving the publisher from being hit.
I would certainly recommend that you upload the files, that are supposed to be used on the pages, to the DAM first and then include  them from there.
That approach would have loads of benefits. Not only will you have your images in one place, which would also mean a lot of positive things in a maintenance point of view.
You would also be using one file from different places and cache only that file, which ultimately would save some disk space on the dispatcher server.

Good Luck
/Johan

Avatar

Level 2

No sure if you got my problem right, might be I was not able to explain properly.

Here you go!

No matter you upload an image from your local machine or assign it from DAM, if you look at the page source the path of the image will be something like "/content/geometrixx-media/en/events/the-lineup-you-ve-been-waiting-for/jcr:content/article-content-par/adaptive_image.adapt.620.high.jpg". So in my case the image was in DAM @ /content/dam/geometrixx-media/images/testImage.jpg. When this page will be requested by a browser, this image will be saved at path "/content/geometrixx-media/en/events/the-lineup-you-ve-been-waiting-for/jcr:content/article-content-par/" with name "adaptive_image.adapt.620.high.jpg". 

In this case, if the same image is being used on multiple pages, those pages will have the same image stored in dispatcher cache under its jcr:content node, which is not good from space perspective. Had adaptive image component referred the same path "/content/dam/geometrixx-media/images/testImage.jpg", it had not had this issue.

Related to this, think of a scenario where in I had 50 html pages in a folder which has its own .stat file. Now one of these pages gets activated, which will invalidate all these 49 other pages. Now if the same image was being used in all these pages, instead of 1, 49 image requests will now go to publish which will now have to do image resizing or what have you which is a CPU intensive operation.

Now Sham to your first reply, what you are saying is, that if I upload an image with the same name "/content/dam/geometrixx-media/images/testImage.jpg", all the pages which are using this like in above example"/content/geometrixx-media/en/events/the-lineup-you-ve-been-waiting-for/jcr:content/article-content-par/adaptive_image.adapt.620.high.jpg" will also get invaliadated? If no, this is an issue. If yes, this is a bigger issue, since it will then invalidate other 49 pages as well even if they were using different images.

Avatar

Correct answer by
Level 10

I got your question from initial post. Take a look at [1] for details. If you have invalidate section correctly configured then activateing the assets alone should update referenced pages also.  

Having 50 pages referring the same asset. Don;t you thing your implementation design is not appropriate because Authors referencing same image on 50 pages individually....  Solve this issue with  as johan suggested with own adaptive image component OR Update implementation to use shared file OR using boilerplates[2] .

[1]  http://dev.day.com/docs/en/cq/current/deploying/dispatcher.html

[2]   https://dev.day.com/docs/en/cq/current/developing/boilerplates.html

Avatar

Level 7

Ah yes now i understand what you mean.
This can be solved by your own adaptive image component.
If you also extend the Image class you can control how the component renders the images to the page.
This class can then be modified in whichever way you like and you can choose to render the address as the DAM instead this will fix the first matter you had that the images are stored under the page in the dispatcher cache. Of course you also have to have the image there from the beginning in this case.

In my case it renders the adaptive image like :
<img ..... some other things .... src="/content/dam/mysite/NicePictures/TheBlueCar.jpg/jcr%3acontent/renditions/cq5dam.web.500.400.jpg">

This will make it store that rendition and all the rest of it's requested renditions in the cache under /dam/mysite/NicePictures/TheBlueCar.jpg/jcr%3acontent/renditions/

I guess that this is what you are after ?

/Johan

Avatar

Former Community Member

Hi Vineet, I am facing the exact same scenario, did you find a resolution?

Avatar

Level 10

Vineet has marked 'Sham HC' comment as correct. So if you follow that it should resolve the issue.

If its still not, then please do create a topic in the forum with the actual issue you are facing