Pages are not being cached even when cacheable = true is set on the host level

Hi everyone,

I am trying to improve our bloomreach server performance on the cloud, and am trying to turn on the page cache. I have been reading and trying all different configurations, but it seems that cacheable is not working as intended. I turn on diagnostic on the hosts level (hst:diagnosticsenabled = true, hst:diagnosticsdepth = 4, hst:diagnosticsthresholdmillisec = 1). I make resourceapi request directly from my chrome browser, and each time i can see from the diagnostic log, the request goes to PageCachingValve and then continues on to PageModelAggregationValve, which will call each component of the page. This happens all the time. I thought if I turn on the cacheable on the host level, and don’t turn it off for all components of the page, the page will be cached. I did try to turn on cacheable on all different level, but nothing seems to work.

Bloomreach version: 14.7
Pipeline: SpaSitePipeline

What am I missing?

The strange thing is it works on my local development (on my own laptop).

Hello, have you taken a look at the scenarios where requests are not cached? For example setting non-caching headers or cookies. See HST Page Caching (Context-Aware Cache) - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS

Hi David,

Thanks for reply. Yes, I did read the page, and i just checked that it doesn’t have any headers or cookies. I even check network requests on the Chrome borwser to make sure none of that is being passed in request or response.

What I do to test if the page is cached or not is by using the “resourceapi” call. Our app is a React SPA application. So we call resourceapi, which just return JSON, and react will render the page. So even the resourceapi is not being cached.

Does anyone know where to check the pageCache.maxSize and pageCache.timeToLiveSeconds for the page cache? Is it supposed to be in web.xml?

Those settings can be overridden in site/webapp/src/main/webapp/WEB-INF/hst-config.properties

The way you are testing seems fine, have you checked the config in case there’s a sitemap or component that’s marked as non-cacheable?

You could always use debugging to see in the PageCachingValve code why it is not caching.

David,

Thanks for reply.

We have a rest api under the site, ie www.qwerty.com/rest/request. So for everything under /rest, it’s not cached (cacheable is false). But all the other pages are under other paths, ie www.qwerty.com/retailers, doen’t have any cacheable settings.

Can you shed some light on how to debug PageCachingValve? I can’t even get the source code.

Did you mean all other paths HAVE cacheable settings? The cacheable needs to be explicitly enabled.

Assuming your IDE is reading the project correctly, you can follow this guide to start debugging Develop with Intellij - Bloomreach Experience Manager (PaaS/Self-Hosted) - The Fast and Flexible Headless CMS

I would start with a breakpoint as shown below - assuming the config is OK, and debugging is working, I would expect it to stop on line 61 when you hit the resourceapi. Then step through the code.

Where can I download the source code?

Your IDE should be able to download those automatically…in case you are using an IDE which is not able to download sources, you can get them from maven repository by using dependency plugin:

https://maven.apache.org/plugins/maven-dependency-plugin/index.html
https://maven.apache.org/plugins/maven-dependency-plugin/sources-mojo.html

or download it manually from maven: Sonatype Nexus Repository

or git:

Thank you.