We have cached country specific custom servlets(e.g /bin/myproject/servlet/us/en/myservlet.json) at the dispatcher in JSON format. When a XF is replicated, we need to clear cached JSON files for all countries. So we are triggering resource-only-flush request for /bin/myproject/servlet.
From Publish logs, could confirm that the flush request is successful.
com.day.cq.replication.Agent.resource-only-flush ------------------------------------------------
com.day.cq.replication.Agent.resource-only-flush Sending message to dispatcher:8080
com.day.cq.replication.Agent.resource-only-flush >> POST /dispatcher/invalidate.cache HTTP/1.0
com.day.cq.replication.Agent.resource-only-flush >> CQ-Action: Activate
com.day.cq.replication.Agent.resource-only-flush >> CQ-Handle: /bin/myproject/servlet
com.day.cq.replication.Agent.resource-only-flush >> CQ-Path: /bin/myproject/servlet
com.day.cq.replication.Agent.resource-only-flush >> CQ-Action-Scope: ResourceOnly
com.day.cq.replication.Agent.resource-only-flush >> Referer: about:blank
com.day.cq.replication.Agent.resource-only-flush >> Content-Length: 0
com.day.cq.replication.Agent.resource-only-flush >> Content-Type: application/octet-stream
com.day.cq.replication.Agent.resource-only-flush --
com.day.cq.replication.Agent.resource-only-flush << HTTP/1.1 200 OK
com.day.cq.replication.Agent.resource-only-flush << Date: Fri, 01 Mar 2024 10:10:10 GMT
com.day.cq.replication.Agent.resource-only-flush << Server: Apache/2.4.20 (Unix) OpenSSL/1.0.2h Communique/4.1.12
com.day.cq.replication.Agent.resource-only-flush << Cache-Control: max-age=0
com.day.cq.replication.Agent.resource-only-flush << Expires: Fri, 01 Mar 2024 10:10:10 GMT
com.day.cq.replication.Agent.resource-only-flush << Vary: User-Agent
com.day.cq.replication.Agent.resource-only-flush << Content-Length: 13
com.day.cq.replication.Agent.resource-only-flush << Content-Type: text/html; charset=utf-8
com.day.cq.replication.Agent.resource-only-flush <<
com.day.cq.replication.Agent.resource-only-flush <<
com.day.cq.replication.Agent.resource-only-flush Message sent.
com.day.cq.replication.Agent.resource-only-flush ------------------------------------------------
com.day.cq.replication.Agent.resource-only-flush Replication (ACTIVATE) of /bin/myproject/servlet successful.
Also from dispatcher logs, could confirm that the invalidation request is received
[Fri Mar 01 11:10:10 2024] [D] [75912] checking [/dispatcher/invalidate.cache]
[Fri Mar 01 11:10:10 2024] [I] [75912] Activation detected: action=Activate [/bin/myproject/servlet]
[Fri Mar 01 11:10:10 2024] [D] [75912] response.status = 200
[Fri Mar 01 11:10:10 2024] [D] [75912] response.headers[Server] = "Communique/2.6.3 (build 5221)"
[Fri Mar 01 11:10:10 2024] [D] [75912] response.headers[Content-Type] = "text/html"
[Fri Mar 01 11:10:10 2024] [D] [75912] cache flushed
But the servlet folder /bin/myproject/servlet is not cleared at Dispatcher cache location.
Any suggestions on what is missing here?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Based on the logs you provided, it seems that the resource-only-flush request was successful and the invalidation request was received by the dispatcher. However, it's possible that the cached JSON files for all countries were not cleared because the invalidation request was not specific enough.
When you trigger a resource-only-flush request for `/bin/myproject/servlet`, it invalidates the cache for that specific path only. It does not invalidate the cache for any child paths or any other paths that may be related to the servlet.
To clear the cached JSON files for all countries, you may need to trigger a resource-only-flush request for each country-specific path, such as `/bin/myproject/servlet/us/en/myservlet.json`, `/bin/myproject/servlet/uk/en/myservlet.json`, etc. This will ensure that the cache for each country-specific path is cleared and the updated JSON files are served from the publish instance.
Alternatively, you can trigger a full cache flush on the dispatcher to clear all cached content. However, this may not be desirable if you have a large amount of cached content or if you want to minimize the impact on the dispatcher performance.
Thanks,
Raja
how do you configure the cache rule to cache the servlet and what the servlet response headers - can you please provide the details
Hi @SureshDhulipudi,
Thanks for the response!
Below is the Cache rule and invalidation rule configured in the dispatcher.
can you try with
@SureshDhulipudi, Thank you for the suggestion! I have tried this already and doesn't help to resolve the issue
Based on the logs you provided, it seems that the resource-only-flush request was successful and the invalidation request was received by the dispatcher. However, it's possible that the cached JSON files for all countries were not cleared because the invalidation request was not specific enough.
When you trigger a resource-only-flush request for `/bin/myproject/servlet`, it invalidates the cache for that specific path only. It does not invalidate the cache for any child paths or any other paths that may be related to the servlet.
To clear the cached JSON files for all countries, you may need to trigger a resource-only-flush request for each country-specific path, such as `/bin/myproject/servlet/us/en/myservlet.json`, `/bin/myproject/servlet/uk/en/myservlet.json`, etc. This will ensure that the cache for each country-specific path is cleared and the updated JSON files are served from the publish instance.
Alternatively, you can trigger a full cache flush on the dispatcher to clear all cached content. However, this may not be desirable if you have a large amount of cached content or if you want to minimize the impact on the dispatcher performance.
Thanks,
Raja
Thank you @Raja_Reddy for the reply.
The root cause you have mentioned seems to be convincing, and we will attempt to initiate the flush request for the servlet specific to the country.