/name "name"
/farms
{
/website # Dispatcher farm configuration
{
# configuration entries
All configuration entries of the dispatcher are at the farm level. And we can have multiple farm entries in the dispatcher configuration file. Through this we can essentially split the content cached in the dispatcher into multiple categories and define different caching characteristics and behavior for each of them.
Use cases made possible by having multiple farms
- Having a common dispatcher for different AEM publish farms
- Say mysite.com/products & mysite.com/offers fetches content from publish farm 1 and publish farm 2 instances
- Selective load balancing based on content accessed
- Say all dam assets are rendered from publish instance 1 and all pages rendered from publish instance 2
- Having different cache folders and cache invalidation rules for content under different paths
- Say all authenticated pages are cached under …/auth_cache and other pages under …/public_cache
These are just some of the representative use cases. In effect the complete dispatcher configuration can vary across farms and can be leveraged to define the behavior required\
Steps in defining the dispatcher configuration
The steps involved in designing for and creating the definition of the dispatcher configuration is depicted in the diagram below
Each step is detailed below
Identifying the no. of farms needed
Analyze the content structure based on its desired caching behavior.
For example, in most cases the caching requirement of the assets and those of the pages could differ
- Assets being independent of each other, invalidating the cache entry of an asset need not impact any other assets
- Pages on the other hand have cross referenced content and typically invalidating a cached page would require invalidating all its subpages and may be other cross referenced content as well
Asses the content structure and classify them based on the caching behavior needed. Each category would typically need a separate farm configuration
Defining the cache behavior of each farm
Now that we have classified and arrived at the listing of the farms needed, define the cache behavior for each farm, covering all aspects of the dispatcher configuration. By now, the configuration entry needed for each section of each farm needs to be clearly documented
Identifying the commonalities and variations in the behavior
With the cache behavior defined for each form, identify which parts of the configuration are common across multiple farms and which parts vary from farm to farm. For example, if all farms connect to the same set of publish instances, the renderer configuration would be common and it would be optimal to have the renderers configured in a single file and included across different farm configuration files
Building the configuration nuggets
Once the commonalities and variations in the configuration of different farms is identified, create individual nuggets of the configuration in separate files. Dispatcher configuration supports including configuration defined in another file through a $include construct.
Note: $include also support * wildcard inclusion.
Once the individual nuggets of configuration are defined, they can be combined as needed in a hierarchy to create the required configuration
Assemble the configurations for each farm and dispatcher.any
The last step would be to assemble the configuration nuggets to arrive the desired setup. Typically use the individual nuggets to assemble each farm configuration file and then include the farm configuration files into the dispacther.any configuration.
A scenario where we define 2 farms – one for dam assets and another for pages but both sharing the same renderer configuration can be defined as
1. renderers.lst
# Listing of AEM Publish instances
Publish_1
Publish_2
...
2. dam_farm_config.any
/dam_farm
{
...
/renders
{
$include "renderers.lst"
}
...
}
3. page_farm_config.any
/page_farm
{
...
/renders
{
$include "renderers.lst"
}
...
}
4. #dispatcher.any
...
/farms
{
$include "dam_farm_config.any"
$include "page_farm_config.any"
}
In this configuration, on addition or removal of publish instances can be managed by editing the single renderers.lst configuration file
Checkout https://www.slideshare.net/AshokkumarTA/aem-dispatcher-tips-tricks for more information on dispatcher configuration
No comments:
Post a Comment
If you have any doubts or questions, please let us know.