Sitecore Incremental publishes

Its worth noting that during further testing we’ve uncovered some subtle nuances of having the setting Publishing.PublishEmptyItems as false. See the end of the post for more details.

When you are dealing with large amounts of content across multiple languages it can often take a long time for publishes to complete, even if the amount of changes are relatively small.

Out the box you are presented with 3 options for publishing: republish, smart and incremental. This post will detail some nuances of the sitecore incremental publishes when triggered via an agent.

Why incremental?
If you are dealing with a small amount of changes but to a large db, why bother processing or publishing the whole tree. The crux of incremental publishes is that you only process the items that have changed since the last publish. This is achieved using timestamps stored in the Properties table which indicates the last point in time a publish was completed.

The Publish agent
In an out the box installation there is an agent available to trigger publishes over time: Sitecore.Tasks.PublishAgent. This is configured in the <scheduling> section of the config and by default is set to run never. Our implementation set this up as follows:

  • interval=”00:15:00″
  • <param desc=”mode (full or smart or incremental)”>incremental</param>
  • <param desc=”languages”>en-GB, fr-fr</param>

Behind the scenes the agent creates a new Publisher, passes in the parameters and then and sets Deep=true.

What’s the problem then?
Deep introduces an odd problem to incremental publishes – in theory they should be as light as possible but there are certain circumstances where changing one node (eg adding a version to a parent with lots of children) would lead to log entries indicating thousands of items had been published:

INFO  Job ended: Publish to ‘web’ (units processed: 11569)

Normal log entries would indicate that at most a hundred or so items should be published each run of the agent.

Can we stop incremental publishes triggering thousands of items?
Surely we can simply set Deep= false? If you make a custom version of the agent its simple enough to parametrize the value passed into the agent however this seemed to introduce other issues.

With the help of support we got to the bottom of a strange issue. After 2 runs of the agent (with 2 languages being published) we would see the child item would be missing the valid version.

Master db Web db after 1 run of the agent Web db after ‘parent’ is made publishable
parent (publishable in the future, en-gb only)
-child (publishable now, en-gb only)
parent (no versions)
-child (no versions)
parent (version in en-gb)
-child (no versions)

This problem was only visible once the second language was added to the publish agent settings.

The solution
Simply add the setting: <setting name=”Publishing.PublishEmptyItems” value=”false” />.

And you should end up with:

Master db Web db after 1 run of the agent Web db after ‘parent’ is made publishable
parent (publishable in the future, en-gb only)
-child (publishable now, en-gb only)
no change parent (version in en-gb)
-child (version in en-gb)

Does this introduce any problems?
Initial testing suggested these changes to the settings would solve our issues. In a multi language solution it was found that subtle problems around the publishing of children items actually caused more problems than were solved by the changes. In the end we avoided the ‘deep’ child publishing by creating a custom version of Sitecore.Publishing.Pipelines.Publish.ProcessQueue, Sitecore.Kernel. In that we then ignored the deep parameter for specific template types.

Leave a Reply

Your email address will not be published. Required fields are marked *