Clean up the EventQueue and PublishQueue tables

Abstract

How to prevent the Sitecore event queue and the Sitecore publishing queue from growing too large and causing performance issues.

Applies to

Content Management, EXM Dispatch, Content Delivery, xDB Processing, and xDB Reporting.

The event queue is a table named EventQueue in the Master database on the Content Management instance. It is used to share events between instances - mostly during index updates and cache clearing.

The publishing queue is a table named PublishQueue in the Master database on the Content Management instance. It is used for incremental publishing of a website.

You can experience performance issues if the queues grows too large. To improve performance, you can clean up the queues on demand, or Sitecore can clean them up automatically.

Important

If you have more than one Content Management instance, you must clean up the queues on each instance separately.

Clean up the event queue on demand

To clean up the event queue on demand:

  1. On the Sitecore Launchpad, click Control Panel, Administration tools, and Event Queue Statistics.

  2. In the Cleanup EventQueue pane, select the Master database.

  3. Edit the Interval to keep after cleanup field to how many hours you want to allow for new entries to be processed before they are cleaned up. Normally, four hours is enough.

  4. Click Cleanup.

Clean up the event queue automatically

You do not have to clean up the event queue on the Content Delivery, EXM Dispatch, xDB Processing, and xDB Reporting instances, so you can safely remove the Sitecore.Tasks.CleanupEventQueue configuration from these instances or deactivate it by setting the interval property to 0.

To configure automatic cleanup of the EventQueue table:

  1. In the <wwwroot>\App_Config\Sitecore.config file, in the Sitecore.Tasks.CleanupEventQueue agent configuration, edit the interval property to specify how often you want the cleanup task to run. Normally, four hours is enough to process new entries:

    <agent
      type="Sitecore.Tasks.CleanupEventQueue, Sitecore.Kernel"
      method="Run"
      interval="04:00:00">
        <DaysToKeep>1</DaysToKeep>
        [<IntervalToKeep>hh:mm:ss</IntervalToKeep>]
    </agent>
  2. Edit the DaysToKeep property to specify the number of days you want to keep entries in the event queue:

    <agent
      type="Sitecore.Tasks.CleanupEventQueue, Sitecore.Kernel"
      method="Run"
      interval="04:00:00">
        <DaysToKeep>1</DaysToKeep>
        [<IntervalToKeep>hh:mm:ss</IntervalToKeep>]
    </agent>
  3. If you want more granularity, edit the IntervalToKeep property to specify the number of hours, minutes, and seconds you want to keep entries in the event queue. The IntervalToKeep property overrides the DaysToKeep property:

    <agent
      type="Sitecore.Tasks.CleanupEventQueue, Sitecore.Kernel"
      method="Run"
      interval="04:00:00">
        <DaysToKeep>1</DaysToKeep>
        <IntervalToKeep>hh:mm:ss</IntervalToKeep>
    </agent>
  4. Save the Sitecore.config file.

Clean up the publishing queue on demand

To clean up the publishing queue on demand:

  1. On the Sitecore Launchpad, click Control Panel, Administration tools, and Publish Queue Statistics.

  2. In the Cleanup Publish Queue pane, select the Master database.

  3. Edit the Interval to keep after cleanup field to how many hours you want to allow for new entries to be processed before they are cleaned up. Normally, four hours is enough.

  4. Click Cleanup.

Clean up the publishing queue automatically

You do not have to clean up the publishing queue on the Content Delivery, EXM Dispatch, xDB Processing, and xDB Reporting instances, so you can safely remove the Sitecore.Tasks.CleanupPublishQueue configuration from these instances or deactivate it by setting the interval property to 0.

To configure automatic cleanup of the PublishQueue table:

  1. In the <wwwroot>\App_Config\Sitecore.config file, in the Sitecore.Tasks.CleanupPublishQueue agent configuration, edit the interval property to specify how often you want the cleanup task to run. Normally, four hours is enough to process new entries, but if you do not use incremental publishing, you can configure it to run more frequently:

    <agent
      type="Sitecore.Tasks.CleanupPublishQueue, Sitecore.Kernel"
      method="Run"
      interval="04:00:00">
        <DaysToKeep>30</DaysToKeep>
        [<IntervalToKeep>hh:mm:ss</IntervalToKeep>]
    </agent>
  2. Edit the DaysToKeep property to specify the number of days you want to keep entries in the publishing queue:

    <agent
      type="Sitecore.Tasks.CleanupPublishQueue, Sitecore.Kernel"
      method="Run"
      interval="04:00:00">
        <DaysToKeep>30</DaysToKeep>
        [<IntervalToKeep>hh:mm:ss</IntervalToKeep>]
    </agent>
  3. Save the Sitecore.config file.