How to reduce page load times after publishing a lot of items


Sitecore uses the EventQueue table to share events between Sitecore instances. Every item modification corresponds to a separate event.
Sitecore Publishing Service focuses on the performance of publishing operations. If the number of manifest steps for a publishing target exceeds a threshold value, a single event entry is created for all the modified items to improve the publishing speed. The event is handled by clearing Sitecore caches and rebuilding the search indexes.
Clearing Sitecore caches might lead to a significant drop in page response times until the caches are repopulated.

Note that the current article is applied to Sitecore Publishing Service 2.0 Update-1 - 4.2.0 and Publishing Service Module 9.1.0 - 9.3.0.


To prevent frequent creation of a single event that triggers Sitecore cache clearings and search index rebuildings, increase the value of the remoteEventCacheClearingThreshold setting in the Sitecore.Publishing.Service.config file, for example:
<param name="remoteEventCacheClearingThreshold">100000</param>
At certain point, the cost of removing cache entries and updating indexes for the modified items outgrows the cost of full cache clearing and rebuilding of indexes.
That is why the value of the remoteEventCacheClearingThreshold setting must be tuned for each solution individually. In most cases, 100000 is a good starting point for tuning.