Hello folks ,
Cache cleaning is an essential part of any architecture or website, and Sitecore makes it simple and effective.
Sitecore manages this with various events. In this blog, we will focus on the Publish:End:Remote event for multiple cm in 1 web app.
Issue
Our Sitecore CM (PaaS hosting) handles heavy traffic, so clearing the cache is crucial. Since we have multiple CMs, we needed a way to ensure the cache is cleared across all of them.
Solution
Remote publish end event will be able to clear the cache on all the CM servers. You need to make sure the scalability setting for multiple CM servers are set properly.
When configuring multiple CM server, only one CM instance will be responsible for publishing. In order to configure the same, you need to provide following configuration on CM servers.
- Assign each CM server, a instance name based on the machine name plus the IIS server name. You must ensure that each CM instance has a unique name.
<setting name="InstanceName"><br>
<patch:attribute name="value"><your unique CM instance name>
<br>
</patch:attribute><br>
</setting>
2. Only one CM instance can perform publishing. You must ensure that each CM instance points to the publishing CM instance.
<setting name="Publishing.PublishingInstance"><br>
<patch:attribute name="value"><your publishing CM instance name> <br>
</patch:attribute><br>
</setting>
Note: On publishing instance server, above setting Publishing.PublishingInstance should be empty.
Conclusion
Efficient cache management is critical in a multi-CM environment to ensure consistent performance and reliability. The Publishing:End:Remote event simplifies this by enabling cache clearance across all CM servers, provided the scalability settings are configured correctly.
By assigning unique InstanceName values and properly setting the Publishing.PublishingInstance, you can designate a primary publishing CM and ensure seamless synchronization between instances. This setup ensures optimal performance and consistent content delivery, even under heavy traffic.
You can find more details for the same here.
Happy coding 😊







Leave a comment