Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

Dispatcher flushing Issue

Avatar

Level 4

For our site when we access through dispathcer we won't keep /content/comapnyname in the URL. For example: If the URL in the author is host:port/content/companyname/abc.html, the same URL through dispather will be prodhost/abc.html.

We have mappings so that prodhost/abc.html resolves to prodhost/content/companyname/abc.html. In dispatcher under cache directory html files are saved as abc.html 

When abc.html is changed in Author and activate it, it is just flushing the root of the cache directory because /content/companyname is not present in the path.

So, with mapping in place how can when we actiavte /content/companyname/abc.html and have cache flushed only for abc.html and not the entire cache directory. 

We have the statfileslevel as '0' , so that's why it is flushing the root but if i keep statfileslevel as '1' it goes and search for /content folder and looking for page under it, which does not exist in cache directory and also it does not flush the cache at root, so abc.html will be the same as before. 

Can anyone please tell me what is the good approach to follow for flushing the cache with mappings present.

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi,

your basic problem is that the publish sends a flush request for /content/companyname/abc but is service /abc.html.

An easy solution would be if you setup 2 different farms:

  • One farm to serve company.com/abc.html
  • One farm for invalidation only.

And the trick is to use a different document root for both farms:

  • for the content-serving one: /opt/cache/content/companyname/
  • for the invalidation farm: /opt/cache

This doesn't require any kind of rewriting or other kind of configuration. This is also part of the official documentation [1], although the setup there is a bit more complex.

Kind regards,
Jörg

 

[1] https://docs.adobe.com/docs/en/dispatcher/disp-domains.html

View solution in original post

6 Replies

Avatar

Level 7

Here is basic example of rules you want in your mod_rewrite (These rules will differ from site to site)

RewriteRule ^/$ <Your home page>

RewriteCond %{REQUEST_URI} !^/apps/(.*) [NC]
RewriteCond %{REQUEST_URI} !^/etc(.*) [NC]
RewriteCond %{REQUEST_URI} !^/libs(.*) [NC]
RewriteCond %{REQUEST_URI} !^/content(.*) [NC]
RewriteCond %{REQUEST_URI} !^/system(.*) [NC]
RewriteCond %{REQUEST_URI} !^/dam(.*) [NC]
RewriteRule ^/(.*) /content/mysite/$1 [PT]
RewriteRule ^/(.*)\?(.*) /content/mysite/$1 [PT]

Above rule make sure that content at right path is getting flushed.

Some more trick (But will not work 100% see http://forums.adobe.com/thread/1082213 for detail):

You can also do something like

LoadModule headers_module modules/mod_headers.so
RequestHeader edit CQ-Handle /content/mysite(/.*) $1 early

Another solution at replication agent level By David to solve this issue,

http://adobe-consulting-services.github.io/acs-aem-commons/features/dispatcher-flush-rules.html

code for above is found here https://github.com/Adobe-Consulting-Services/acs-aem-commons/tree/master/bundle/src/main/java/com/ad...

 

Thanks

Tuhin

Avatar

Level 9

stat file level 3 is ideal for managing caching. 

Regards,

Jitendra

tc94524330 wrote...

For our site when we access through dispathcer we won't keep /content/comapnyname in the URL. For example: If the URL in the author is host:port/content/companyname/abc.html, the same URL through dispather will be prodhost/abc.html.

We have mappings so that prodhost/abc.html resolves to prodhost/content/companyname/abc.html. In dispatcher under cache directory html files are saved as abc.html 

When abc.html is changed in Author and activate it, it is just flushing the root of the cache directory because /content/companyname is not present in the path.

So, with mapping in place how can when we actiavte /content/companyname/abc.html and have cache flushed only for abc.html and not the entire cache directory. 

We have the statfileslevel as '0' , so that's why it is flushing the root but if i keep statfileslevel as '1' it goes and search for /content folder and looking for page under it, which does not exist in cache directory and also it does not flush the cache at root, so abc.html will be the same as before. 

Can anyone please tell me what is the good approach to follow for flushing the cache with mappings present.

 

Avatar

Administrator

Hi

Can you please look at the answers posted and let us know if this worked for you or not.

If you have devised another way to resolve the issue, please post it in the community for communities benefit.

 

Thanks and Regards

Kautuk Sahni



Kautuk Sahni

Avatar

Correct answer by
Employee Advisor

Hi,

your basic problem is that the publish sends a flush request for /content/companyname/abc but is service /abc.html.

An easy solution would be if you setup 2 different farms:

  • One farm to serve company.com/abc.html
  • One farm for invalidation only.

And the trick is to use a different document root for both farms:

  • for the content-serving one: /opt/cache/content/companyname/
  • for the invalidation farm: /opt/cache

This doesn't require any kind of rewriting or other kind of configuration. This is also part of the official documentation [1], although the setup there is a bit more complex.

Kind regards,
Jörg

 

[1] https://docs.adobe.com/docs/en/dispatcher/disp-domains.html

Avatar

Level 3

Hi @Jörg,

I have one clarification to make for this strategy. How will the flushing of files other than "/content" path be handled? For example, we have "/etc", "/etc.clientlibs" folders in the cache which have css, js, json, image(maybe) files. The content serving farm will serve the files as - /opt/cache/content/companyname/etc/abcompany/clientlibs/style.css, while when the css is activated, the flush agent will try to flush at the following path - /opt/cache/etc/abcompany/clientlibs/style.css, which will not be there and hence will not flushed. Similarly, all js, css files will not be flushed automatically on activation.

Could you provide some workaround for this scenario?

Regards,

Gaurav

Avatar

Employee Advisor

Hi,

During deployments (where JS and CSS typically is changed) you should clean your cache. Because there is also the chance, that all the pages are supposed to look differently.

In my deployment procedures there is always a step "clear dispatcher cache".

Jörg