Thursday, September 12, 2013

Clearing Indexes on Sitecore Content Delivery Servers

For anyone that is building a website on Sitecore you have probably come across this issue. In even a basic production deployment of Sitecore you have a content management box and a content delivery box. When content is updated on the management servers you want your content delivery box’s indexes to be updated. Some people think you need to create your own custom process to move content management indexes out to the content delivery services. They think this because the content management box detects the indexes needs to be updated and runs the process to update its indexes, but there is nothing on the content delivery boxes to do this. Well this is just not true. To be honest if it was true Sitecore would have a serious short coming if they expected this process to be created manually every time by everyone.

Alex Shyba has written a great post with additional details on how all this works. Of course there is also the Sitecore docs you can reference.

The fact is the web.config file or your own include configs (best approach is in the app_config include folder) have values that can be set to tell the content delivery servers to check at a certain interval to see if their indexes need to be updated. To do this there are a couple key config values you need to set.

<setting name="Indexing.UpdateInterval" value="00:05:00"/>

This setting tells the servers how often to check for index updates. This does not mean the index will always update this often. It only means it will check to see if it needs to update. If you want details on what it is checking and how it knows if the index is dirty please see Alex’s blog.

There is another key setting you have to have as well to make this work on the content delivery servers.

<setting name="Indexing.ServerSpecificProperties" value="true"/>

If this value is not set, or set to false, on the content delivery servers your indexes will never update. Again see Alex’s blog for details on why.

This may or may not light things up for you. There is one more key config file in the web.config you have to enable. If you read Alex’s blog he mentioned the event queues (but never this value). By default Event Queues are disabled in the web.config. If they are disabled this notification about indexes will not make its way to the content delivery servers. 

<setting name="EnableEventQueues" value="true" />

Make sure this setting is also true. Once you have all of these set the content delivery servers should start updating on the defined interval on their on when a index event is queued. Don’t make your UpdateInterval to short as it could start causing performance issues (if it is set to 00:00:00 it is disabled).

No comments: