Highlighted

AEM Mongo Cluster

DhirajAg

22-10-2018

I have three AEM author instances in a cluster - Mongo 3 instances replica set.

If i make a change to a template in crxde in one of the instances, i can see the change getting reflected in all 3 AEM instances in crxde, but when I am hitting a page of that template changes are not reflecting in the other two instances. Is there a cache configuration I am missing?

Have tried this on AEM 6.3.2 and 6.3.3

Restarting Apache Sling Resource Resolver on the other instance resolves the issue and I can see the new changes on the page.

Replies

Highlighted
Highlighted

DhirajAg

22-10-2018

Yes restarting the server also resolves the issue, but why is it happening in the first place. Also restarting the server in a prod environment is not possible.

Highlighted

DhirajAg

22-10-2018

So I found the HTMLs to be cached at /system/console/scriptcache . Once I cleared this cache it worked fine. I then changed the config at Apache Sling Script Cache to set the cache size to 0 so that nothing is cached. However i think this is an odd behavior of AEM in a mongo cluster where the cache is not invalidated automatically from the other AEM servers.

Any pointers on this ?

Highlighted

Jörg_Hoh

Employee

23-10-2018

What template have you changed? is it an editable template and you expected that all pages it using have been adapted (what should happen)?

Jörg

Highlighted

DhirajAg

23-10-2018

It is not an editable template but a static template and if i make a change on one server, the HTML of that component is invalidated on only that server and not the others. I believe since the change is reflected in all servers of the cluster the cache should also get invalidated in all, else there would always be an issue of some servers showing different content.

Highlighted

Jörg_Hoh

Employee

23-10-2018

what do you mean with "the html of that component is invalidated ..."? Do you modify a template T (more specifically a page component T) and then you open a page based on this template/page component T ? And only on the server on which you perform the change the page display is changed, but not on the 2 others?

Highlighted
Highlighted

Jörg_Hoh

Employee

23-10-2018

indeed, that's strange. Changes to components should be picked up by observation and then the script cache should get invalidated, there shouldn't be any explicit invalidation. Can you set the loglevel for the class "org.apache.sling.scripting.core.impl.ScriptCacheImpl" to DEBUG  and re-do your tests again? Make sure that this logging is set on all cluster instances.

Jörg

Highlighted

DhirajAg

23-10-2018

This is what i found in the debug log and this was observed on the server where the change was done and not seen in other servers.

23.10.2018 17:10:50.296 *DEBUG* [sling-script-cache-thread-pool-1] org.apache.sling.scripting.core.impl.ScriptCacheImpl Detected script change for /apps/sample/components/templates/cnt-errorpage/footer.html - removed entry from the cache.

23.10.2018 17:11:00.368 *DEBUG* [sling-script-cache-thread-pool-2] org.apache.sling.scripting.core.impl.ScriptCacheImpl Detected script change for /apps/sample/components/templates/cnt-errorpage/footer.html - removed entry from the cache.