Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

AEM Mongo Cluster

Avatar

Level 4

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.

9 Replies

Avatar

Level 10

There are situations where i can seen when a restart resolves issues. This may fall into one of those situations.

Avatar

Level 4

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.

Avatar

Level 4

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 ?

Avatar

Employee Advisor

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

Avatar

Level 4

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.

Avatar

Employee Advisor

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?

Avatar

Level 4

Thats correct Jorg. In my scenario i am modifying a page component but it can be any script that is compiled.

Avatar

Employee Advisor

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

Avatar

Level 4

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.