Does AEM have any sort of distributed caching which can be used?

Avatar

Avatar
Affirm 5
Level 4
TB3dock
Level 4

Likes

37 likes

Total Posts

223 posts

Correct reply

5 solutions
Top badges earned
Affirm 5
Ignite 10
Boost 25
Give Back 25
Validate 10
View profile

Avatar
Affirm 5
Level 4
TB3dock
Level 4

Likes

37 likes

Total Posts

223 posts

Correct reply

5 solutions
Top badges earned
Affirm 5
Ignite 10
Boost 25
Give Back 25
Validate 10
View profile
TB3dock
Level 4

04-05-2021

Using querybuilder to retrieve pages and components to build json responses in servlets is very slow (seconds).  The obvious solution is for us to cache all the required pages components properties, and just read off the required page properties from cache.  Usually you would use distributed memory cache such as memcached, or an external cache such as redis.

Does AEM have anything like this out of the box?

If we setup memcached, presumably it will have to one perinstance, and not distributed.  This will make manual flushing difficult.  If we use external cache, such as redis, then this will be slower as we cant host redis in the same DC as AEM cloud (As we don't know here they are hosted) so latency will again be an issue.

Any suggestions?

The use case is recent / favourite games.  If we have say 500 game pages, each with several components with properties such as category, image, description etc.  We would get a list of recent game IDs from the server, then need to lookup up each page with the correspoding game ID or code, then look up the required components on that page, in order to display thumbnails and short text etc.  Given the slow speed of querybuilder, we could cache the pages and their properties in memory for quick lookup, and then refresh the pages every 5 minutes or similar in case they get edited by content editor (a flush feature would be nice, but would have to flush all cloud instances which is presumably hard)

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Applaud 25
Level 10
asutosh_jena
Level 10

Likes

593 likes

Total Posts

705 posts

Correct reply

207 solutions
Top badges earned
Applaud 25
Give Back 100
Boost 500
Affirm 100
Ignite 1
View profile

Avatar
Applaud 25
Level 10
asutosh_jena
Level 10

Likes

593 likes

Total Posts

705 posts

Correct reply

207 solutions
Top badges earned
Applaud 25
Give Back 100
Boost 500
Affirm 100
Ignite 1
View profile
asutosh_jena
Level 10

04-05-2021

Hi @TB3dock 

 

You can try for EhCache which caches the object at the JVM level. Please see more details below:

https://www.ehcache.org/documentation/2.8/code-samples.html

http://blog.atish.me/2016/12/25/AEM-Ehcache/

 

Thanks!

Answers (2)

Answers (2)

Avatar

Avatar
Affirm 50
Employee
markus_bulla_adobe
Employee

Likes

148 likes

Total Posts

131 posts

Correct reply

62 solutions
Top badges earned
Affirm 50
Boost 100
Applaud 25
Affirm 25
Boost 50
View profile

Avatar
Affirm 50
Employee
markus_bulla_adobe
Employee

Likes

148 likes

Total Posts

131 posts

Correct reply

62 solutions
Top badges earned
Affirm 50
Boost 100
Applaud 25
Affirm 25
Boost 50
View profile
markus_bulla_adobe
Employee

04-05-2021

Hi @TB3dock!

I'm not sure if I understand your use case 100% correct.

I'll just leave some general advice with regards to caching.

When working with AEM, you can leverage several levels of caching:

  • Browser caching (setting according headers on your HTTP response)
    Usually, this can be applied best for long living resources, such as JS and CSS files or certain images (e. g. a logo). But with shorter TTLs (time to live), this can also be leveraged for HTML pages or other responses (e. g. XHR). General advice is to start with short TTLs and increase them in small and granular steps. If applied correctly, this can boost the performance of your website.
  • CDN Caching
    If you are using a content delivery network (CDN), this gives you another layer of caching. AEMaCS comes with an integrated CDN, so you already have that in place and can evaluate if your application/pages is leveraging it to its optimum.
  • Dispatcher Caching
    For AEM it is always recommended to cache as much as possible on the dispatcher level and design your application to allow for maximum caching. If you are able to cache the requests that lead to long running queries on your publish instances, this will avoid calls to the publisher altogether. If applied correctly (and reflected in the design of the application), you can really cache a lot. It is not uncommon, especially for marketing websites, to achieve caching rations of more than 95%. Of course, this depends on the nature of the website and your application design. Please note that you can not only cache HTML pages, assets, JS and CSS files, but also JSON responses (XHR) and similar requests.
  • In-memory caches
    In addition to the above mentioned layers you can also introduce caching solutions on the AEM layer. A common choice is Ehcache as already mentioned by @asutosh_jena. AFAIK there is no OOTB integration for this layer of caching.

Please also bear in mind that caching is easy but correct cache invalidation is hard (some even say it's impossible). 😉

Hope that helps!

Avatar

Avatar
Springboard
MVP
Shashi_Mulugu
MVP

Likes

232 likes

Total Posts

294 posts

Correct reply

67 solutions
Top badges earned
Springboard
Bedrock
Validate 1
Applaud 100
Establish
View profile

Avatar
Springboard
MVP
Shashi_Mulugu
MVP

Likes

232 likes

Total Posts

294 posts

Correct reply

67 solutions
Top badges earned
Springboard
Bedrock
Validate 1
Applaud 100
Establish
View profile
Shashi_Mulugu
MVP

04-05-2021

@TB3dock have you thought of using a dedicated search service such as elastic or solr which will give you json output which you can use in any of FE frameworks to render pages on fly..?