◷ Reading Time: 2 minutes
Parallelism allows a collection or sequence of independent objects (facts) to be passed through to logic documents in parallel. This allows you to utilize the maximum amount of the machine’s (server) processing power.
FlexRule Runtime engine is a thread-safe that allows you to run the logic in a multi-threaded manner. Either traditional threading mechanisms or modern Parallel (Task Parallel Library – TPL).
FlexRule Runtime supports multiple levels of parallelism during the execution:
- On the logic document
- On the expression
Processing a collection in parallel is no different than any standard pattern to implement multi-threading or parallel processing in your application. You can simply call the Run method of the engine from within your code. Just ensure the objects that are passed support multi-threaded behaviours.
For more information, please check Processing collection using Parallel (TPL)
Parallel and Expression
FlexRule Runtime monadic expression language supports Parallel processing built-in. In the monadic operators, all operators ending with Grave Accent ( ` ) postfix are the parallel enabled.
Sample: people |where` (x, x.Age == 3) Result: A sequence of business objects that has all the people with the Age of 3
In the above example, the where operator will filter the input data (people) in parallel mode. Once it filters them all, it returns the result.
Please visit the list of parallel operators for more details.