I have been playing with the idea of changing script domain model from isolated to low for performance boost of my scripts. I was wondering about what kind of scenarios that can cause "unintentional side effects" as the help guide mentions. Also, what are those unintentional side effects that is being warned about.
Question
Question
possible problematic scenarios of script domain model being set to single mode in Workflow Admin
Answer
If you are looking for boosts to script activities run speed, I'd look at the following two options.
First, in Advanced Server Options, uncheck Script activities in 'Run the following activities as a tasks'. This option will change scripts to run directly as part of the workflow execution instead of in a separate, throttled work queue. We throttle scripts by default because we have found they tend to access resources that are often overloaded by too many simultaneous thread requests.
Second, and to answer your question, I'd go with Shared over Single . The performance gain between Isolated and Shared can be huge. The performance gains from Shared to Single are more memory related then speed related.
The scripting domains control what AppDomain the scripts are loaded into. Scripts that are loaded into the same app domain have access to the same static class members as other scripts. They can also access these static members concurrently in different threads if more then one workflow instance is running so thread safety potentially becomes important.
So the logic of the safety ratings is this:
Isolated, everything is pretty much safe to run. There is a very low chance of code between two scripts interacting with each other unexpectedly.
Shared -> Everything authored by the same person in a workflow runs together, so that person can be responsible for ensuring safety. Lower safety rating because workflows can have multiple authors and you have to remember everything you did when you come back to the workflow months and years later.
Single -> Really only safe if all workflows are authored by the same person and that person understands the code they are using.