Documentation Center

Understanding the isolation level of the handler

Explains the significance of isolation level configuration value for a background task handler.

Every handler configuration in the Background task XML settings defines an isolationLevel within the execution element .

The isolation level is allowed to have one of the following values

  • None
  • Process

When the value is None then all background tasks of this handler will execute within the process of the background task service.

Every operating system process has a limited amount of resources that it can access. With the background task service, we are interested in the memory limitation. The process's maximum memory must be shared between the requirements of the service's components but also the running background tasks.

There is also the potential of memory leaks than can be caused by a background task. Although the background task service is optimized against memory leaks it can run out of memory because a background task had misused the memory.

Different combinations can result to an unstable background task service process or handler that runs out of memory. To protect the background task service but also provide an isolated memory space to a specific background task, the Process value was introduced for the isolationLevel. When this configuration is enabled for a handler, the background task service will spawn a new process with the sole goal to execute this specific background task instance. This way the execution is isolated within the memory space of a specific process that is dedicated fully for the background task. Also any memory leak caused by the handler's execution is limited to the lifetime of this process and has no effect to the background task service process. There is an overhead though. A new process means that everything has to be loaded resulting to slower startup times of the actual execution. The total overhead depends on the load on the server.

This way the handler receives maximum memory space and also the background task service is protected against memory leaks. The only tradeoff is a potential overhead in the total execution time.

Based on the above, here are some suggestions to help you get to the correct value for isolationLevel of a handler:

  • If the handler of the background task requires a lot of memory then it must be isolated.

  • If the handler has the potential to execute for long then it should be isolated.

  • Choosing Process for the isolationLevel should take into account the overhead of the startup time compared to the average actual execution time of the handler

Out of the box configuration has all handlers configured to execute with isolationLevel set to None. Only for EXPORTFORPUBLICATION is configured to execute with isolationLevel set to Process because it is very memory intensive. Because it has the potential to execute for long the extra overhead in startup time is small relative to the average expected execution time.