This is a common question around multi threading in Orchard.
I have a module with a controller providing an action to execute a DB synchronization which takes a very long time. The action basically executes a for loop over several hundred items whereas each item could be processed / synchronized independently.
While researching how to improve performance i came across several possible solutions
- async/- awaitkeyword
- parallel for loop
- Orchard.Environment.Work<>
- Orchard.Caching.IParallelCacheContext
- Orchard.Caching.ITask
- asynccontroller actions (also combined with the return value- Task<>)
and many more.
What would be the best way to improve performance of the for loop without bypassing possible optimizations already implemented / provided in Orchard?
 
    