6. | Light BPT & Parallel processing
● Background processing
● Event handling
● BPT workload separation
● Large scale batch processing
● Replace timers without schedule
Some possibilities
7. | Light BPT & Parallel processing| Light BPT & Parallel processing
How to enable?
8. | Light BPT & Parallel processing
Enabling the Light
1. Enable Light execution
2. Expose Process events
3. Set Launch On
4. Use one automatic activity
9. | Light BPT & Parallel processing
Enabling the Light
1. Enable Light execution
2. Expose Process events
3. Set Launch On
4. Use one automatic activity
10. | Light BPT & Parallel processing
Enabling the Light
1. Enable Light execution
2. Expose Process events
3. Set Launch On
4. Use one automatic activity
11. | Light BPT & Parallel processing
Enabling the Light
1. Enable Light execution
2. Expose Process events
3. Set Launch On
4. Use one automatic activity
12. | Light BPT & Parallel processing| Light BPT & Parallel processing
Is there a Demo?
13. | Light BPT & Parallel processing
Demo case
Import a set of records using 3 different import methods
● Step 1: define a (large) dataset to import
● Records include dummy data to be processed.
Demo application can be downloaded from the forge
https://www.outsystems.com/forge/component-overview/7096/light-bpt-demo
14. | Light BPT & Parallel processing
Import a set of records using 3 different import methods
● Step 2: import dataset using:
■ OutSystems Timer process
■ OutSystems Light Processes (LBTP) single records
■ OutSystems Light Processes (LBTP) using batched records (defined in JSON)
● Record import processing means
■ Get the record to be imported
■ Process it (simulated by a ‘sleep’ command per record)
■ Delete the record to be imported
■ Commit the transaction
16. | Light BPT & Parallel processing
Take control
● Use of Dispatchers, Mediators, and workers for more control
Dispatcher (controller) Mediator (Foreman)
Worker
BPT BPT
Light
BPT
18. | Light BPT & Parallel processing
Conclusion
● Parallel processing
speedup
● Multiple records simultaneously
speedup again
● Server load distribution
less strain
● No unnecessary logging of process data less data
We are here to present you some insights about and applications of Light processes.
Together with my colleague Johan we will be showing you the lessons learned when implementing Light processes.
We had a timer job that took long. We wanted to speed it up using parallel processing, so we came across Light BPT.
But first, what is Light BPT? or better yet, what is BPT?
BPT is a powerful built-in tool to model and monitor business proceses. One of the purposes that BPT can be used for is to handle long running transactions like invoicing, order management, after sales.
Suppose you would want to send an email to your customer with a survey based on their order, wait for the results to come in, process that result etc etc.
You can do this with timers ofcourse, but outsystems offers you so much more with BPT.
For instance with BPT you can have up to 10 threats running at the same time by default. A timer runs only on one thread at a time. Besides, your business process could be much more readable than using different sets of timers
What’s more, BPT has built in error handling, in that the automatic activities are rescheduled after an uncaught exception. When uncaught exceptions keep occuring, the scheduler will postpone the execution of the activity incrementally, until it is executed once a day.
You can even start the logic in your process based on database triggers. As you see in this picture, the process is automatically started after a new PreOrder is created in the database. This process is not dependent on which module creates the PreOrder. It could come from a webservice, a screen action, or within a timer job.
Normal processes can handle 10 threads at the same time per front-end by default. This amount is higher for light processes.
With light processes there are no callback actions like on ready, on close, or on skip.
This allows for a quick start of the activity when the light process is started.
Output parameters of activities are of no use for Light BPT since light processes can only contain one activity.
There is also no process logging for light processes, thus less storage space is taken up.
Light processes are perfect for background processing. You can think of event handling like sending emails or notifications, generating invoice pdfs, you name it.
You could as well separate the automatic part of a normal process into one or two light processes. This way your process could become smaller. and faster.
What about data transfers like imports. You may need to uncover the dependencies of your data model, but light processes can be very handy with data imports or migrations.
Timers that have no schedule, which would be started based on something in your system could also be nice candidates for light processing.
So where do you start? In just four steps you can have your light process up and running. Light processes were introduced since platform server 10.0.804.0
You will need to enable light process execution in service center. This is found under the Operations tab of the Module or espace that will contain the light process.
Then you will need to expose the process events of the entity that will form the start trigger of the light process.
old -
This step is kind of optional, as you can also do this in the next step, step 3.
It is important to set the Launch On property of your light process. This is neccessary for the system to recognise this as a light process.
This means that after a new record is created in the selected entity, this light process will start. Because a create database action triggers this light bpt, that means that you always have the ID of that record
old -
I mentioned that you can skip step 2. When you select the Launch On, you can also choose the very first option that reads <Another Event>
Here you will see the entities of this module, and their Create entity action. Regardless of whether the Expose Process Events is true or false
Choosing one in this list will set the Expose Process Events to true for that entitiy if it was not true already.
You will also see the list of entities that are referenced, And have their process events exposes. So if you are referencing an entitiy from another module, and its process events are not exposed, you will need to do this in the referenced module and publish it. Only after that will you be able to select those process events in this window
Moving on, your final consideration is to have your process contain only one automatic activity. And that’s it. Your process will be light from now on. You will be notified of which processes are considered light processes when you publish the module. Other processes in that module are considered normal processes. So you can have both normal and light processes in the same module.
In a timer you are in control of handling the records in a specific order, which entities will be imported first etc.
Because LBPT work is done in random order you never know which records will be processed first
This means you have no control on what to start when or when something can only start when a job is done
Of course you can build this yourself like we did it in our own products.
If you want to know more about it come to me after this session
Light processes can be very useful. You can definitely gain a huge momentum with light processes when it comes to processing of large amounts of data, be it importing, exporting or processing with business logic.
Doing things parallel can be to your advantage when it comes to speed. You may even experience a greater speed gain when you process multiple records with one light process.
Instead of one core being busy all the time (in case of timers ), light processes allow the server to distribute its work over multiple cores.
Since process logging is skipped for light processes, your database will remain smaller.
Now you also don’t need to think about heavy timers, timeouts and the likes which are valid concerns when it comes to timers.