AEM Mongo Cluster

Avatar

Avatar

DhirajAg

Avatar

DhirajAg

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

Avatar

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K

Avatar

smacdonald2008

Total Posts

12.7K

Likes

1.4K

Correct Reply

2.3K
smacdonald2008

22-10-2018

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

Avatar

Avatar

DhirajAg

Avatar

DhirajAg

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.

Avatar

Avatar

DhirajAg

Avatar

DhirajAg

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 ?

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

942

Correct Reply

1.0K

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

942

Correct Reply

1.0K
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

Avatar

Avatar

DhirajAg

Avatar

DhirajAg

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.

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

942

Correct Reply

1.0K

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

942

Correct Reply

1.0K
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?

Avatar

Avatar

DhirajAg

Avatar

DhirajAg

DhirajAg

23-10-2018

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

Avatar

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

942

Correct Reply

1.0K

Avatar

Jörg_Hoh

Employee

Total Posts

3.0K

Likes

942

Correct Reply

1.0K
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

Avatar

Avatar

DhirajAg

Avatar

DhirajAg

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.