Running pipeline processors concurrently

Current version: 10.2

You can run multiple pipeline processors concurrently by enabling async mode. This allows you to invoke each processor in a separate task. This can improve performance when starting Sitecore from scratch.

Warning

This feature is experimental, and must not be used for production purposes. We strongly recommend testing the feature thoroughly on your specific environment and configuration before using it. The feature is implemented mainly to get feedback from the developer community on how it works in test installations.

You must only use the async mode feature for the Initialize pipeline. The multiple processors of this pipeline can be invoked independently and are therefore suitable for running concurrently.

The async mode feature is disabled by default because its behavior is unpredictable when used with custom processors and custom configurations.

Enabling the async processor mode

You can enable the feature by adding the RunMode attribute to the Initialize pipeline processors. If this attribute is not present, the processors use the default value of Sync.

It is highly recommended to add the RunMode attribute in a separate patch file as shown, for example, in the Sitecore.Experimental.Async.Initialization.Pipeline.config.example file. Using a patch file lets you enable or disable the async mode quickly and easily.

When the feature is enabled, you can invoke each processor in the following ways:

Mode

Description

Sync

The default mode. The processor runs in the main thread.

AsyncToEnd

The pipeline invokes the processor in a separate task. The task finishes when the pipeline is done.

Async

The pipeline invokes the processor in a separate task. The task finishes either when the next WaitAsync processor is invoked, or when the pipeline is done.

WaitAsync

The pipeline waits for all Async processors that started before the current processor to run, before invoking the current processor in the main thread.

The setup, configuration, and load of your installation influences what the best RunMode setting for the processors is. It is therefore not possible to give a general recommendation about how to configure this feature.

Each processor of the pipeline runs in the order that you specify in the configuration. If a pipeline invokes a processor in a separate task the pipeline automatically creates the task.

Note

The pipeline arguments are not thread-safe, so you must run all processors that share and modify the same pipeline argument data in Sync mode.

Do you have some feedback for us?

If you have suggestions for improving this article,