[Parallel Processing] Help

Forge Component
Published on 2017-07-31 by Guilherme Pereira
8 votes
Published on 2017-07-31 by Guilherme Pereira

How does it work?

The framework is quite simple. It requires you to create a REST layer on top of your application just for the calls you want to parallelize.

Then using the framework API you can create as many requests as necessary and use the component to execute all at once. The request will wait until all of them are finished and then return a list of responses.

The following diagram shows how the framework operates:


Why the REST layer?

It’s the most lightweight approach with minimal cost. You can easily abstract your actions by copy pasting them into the REST API and invoke the original action.

Does it work with complex types?

Yes. If your original action receives or return complex types you should create structures reflecting those inputs/outputs and use the JSON Serialization/Deserialization mechanism with the platform.

What should I care about on my actions?

You should take into consideration that your action will be executed in a REST context and potentially in parallel. Because we’re talking about a REST call you should not rely on the Session except if it’s usage is fully contained within the action itself. You should also take into consideration that on this context there’s no authenticated user so you may need to adjust.

Finally because of parallel execution you need to be careful when writing to the DB and transactions to avoid locks between your threads.

How about security?

Using this on the same infrastructure you should make sure that your ParallelExecution REST API uses both https and is marked as internal. If needed, you’ll have to create your own security mechanism and incorporate it into your calls.