Thursday, October 29, 2020

Dispatcher in AEM

 

Dispatcher in AEM

 

 

Dispatcher is CQ Load balancing and caching tool. It runs on web server (IIS or Apache).

 

In order to improve CQ response time it is very important that web server serves that most of the content.

 

Dispatcher provides following benefits:

 

·        Load Balancing: Dispatcher provide a way to balance load between different publish server.

 

·        Static Content delivery: Dispatcher provide powerful way to deliver and invalidate static content.

 

·        Security: Dispatcher add extra layer of security to CQ hosted site.

 

·        Fail safe coverage: In case CQ instance is down dispatcher can serve request.

 

·        Dispatcher module provide various configuration to optimise Content delivery in CQ.

 

Dispatcher follow simple rule:

 

·        If document is present in cache, dispatcher returns document from cache

 

·        If Document is not present in cache then request is made to CQ instance to serve document. In addition, depending upon if document can be cached or not it is cached in dispatcher.

 

 

 

 

There are two way content is being updated in dispatcher:

 

·        Content Update: Through Syndication request from Author or publish request. This cause cached files to be deleted from dispatcher and update "statfile".

 

·        Auto invalidation: This cause part of cache is invalidated without physically deleting cached file.

 

Which documents is subjected to caching in Dispatcher:

 

·        If document is requested through GET or HEAD request

·        If there is no query parameter (?) in request

·        If there is no extension to request. In that case, dispatcher cannot determine MIME Type and hence cannot cache.

·        If there is no authentication header to request.

·        If document is not denied by caching rule in dispatcher.

 

How Dispatcher returns document?





Setting CQ Dispatcher Flush Agent

 

CQ Flush Agent is required to invalidate / clean dispatcher cache. Before you set dispatcher Flush, make sure that replication agent is set up properly.

 

It is recommended to configure dispatcher flush agent on publish instance.

Configure Dispatcher Flush On Publish:


·        Go to HOST:PORT/libs/cq/core/content/login.html

·        Login as admin / admin

·        Then click on Tools -> Replications -> Agents on Publish

·        Then click on new -> Page -> Give Dispatcher Agent Information

·        Once page is created, Double click on dispatcher flush agent and then click on edit

·        Then on transport tab and enter dispatcher server URL.

·        URL is HOST:PORT/invalidate_only/dispatcher/invalidate.cache when this request reaches dispatcher, Dispatcher module knows that it is flush request and then it invalidate cache.

·        From Trigger Tab set triggers. This is required if you are setting dispatcher flush agent on publish instance (But not if you are setting it on author). Through these trigger replication agent knows when to trigger flush.

·        Once all settings are done you can select dispatcher flush agent and click on replicate (Make sure that replication agent is configured before and you see green light at the end of replication).

·        You can then create multiple flush agent using above steps.

·        Note that dispatcher flush only happens on resources of type cq:Page on publish instance.

 

 

No comments:

Post a Comment