Timers vs BPT vs Light BPT: A comparison of which to use when in OutSystems

William Antunes
6 min readNov 4, 2020
If you don’t use the right tool to process your asynchronous tasks, it can easily become a bomb about to explode

While most developers know how important timers, BPT processes, and Light BPT processes are for designing their solutions in the OutSystems platform, they may not know when and why to use them.

You will find out more about it in this article!

The first aspect that I would like to tell you is that all these tools have few characteristics in common. For instance, they are all tools that allow developers to do asynchronous tasks in the background. Those tools also have timeouts, even though each of the above items has a specific timeout that can or not be changed by the developer. We will get into this kind of detail while explaining each of them separately.

This article is not a how-to work with those tools but a comparison in terms of defining in which case those tools suit the best.

So, let’s get started with a quick explanation of each!

Timers

Timers are probably the most known (to not say easy, even though timers can get complex and if not well planned can be a nightmare) way of processing background tasks.

A simple example of a timer usage is to consolidate daily application’s data. You can use a timer running during the night (to avoid slowness of the server when users are actively using the app), to consolidate the data of the previous day.

Those are the main aspects of a timer:

  • Can be scheduled in three different ways, via service studio (1st picture), via service center (2nd picture) or the schedule can be dynamically set through the application (3rd picture), you can also schedule it to run when you publish the module:
Scheduling a timer via service studio
Scheduling a timer via service center (Go to modules -> Click on your module -> Go to timers tab -> Click on your timer)
Dynamically changing timer's schedule
  • Have a default timeout (20min) but that can be changed if it is needed, even though this is not recommended for most of the cases. You can also change the timeout of the timer using the above screens.
  • It is not possible to run multiple instances of the same timer in parallel in the same front-end server unless your timer is multi-tenant and you run it for multiple tenants.
  • Timers holds one single server action as its executable task.
  • You can wake up a timer manually by calling the WakeYourTimerName action, you can find these actions underneath the timer itself.
  • It is possible to run the timer manually by clicking on the “Run Now” button on the service center (see picture 2 above).

Timers are used in case you need to process something in the background, but you need to take care of a few things to have a good and performing timer. I recommend you to watch the ODC 2018 talk about heavy timers from João Filipe Rodrigues.

Business Process Technology (BPT)

BPT is a huge engine that the OutSystems platform provides us to be able to automate business processes.

To exemplify that we can think of an approval process, this is one of the most common use cases for BPT processes. Basically, we have ways to create multiple activities (tasks) inside the same process and each task can either be automatic (don’t need a human intervention) or assigned to someone or to a group of people. Tasks can run in parallel but can also wait for each other to go forward in the BPT flow.

Let’s take a look at a few aspects of a BPT:

  • Each automatic activity has a default timeout (5m) that cannot be changed.
  • OutSystems platform logs pretty much everything that happens with a BPT process, you can find more about it here.
  • The processes tab in service studio has its own toolbox:
  • You can launch a process either by selecting a data action in the Launch On property of the process (1st picture) or launch it manually by dropping the launch process action anywhere in your logic (2nd picture):
Launch On Property
Launch Process Action
  • BPT processes can run 10 parallel threads per server by default.
  • Is able to execute multiple tasks in the same BPT flow.

Light BPT

A few years ago OutSystems introduced a new and modern way of processing batches of data by adding a few improvements that could be done in the BPT mechanism without changing the whole BPT concept.

Why is it called Light BPT?

Light BPTs are a simpler and lighter version of the normal BPT, here are the main aspects of a Light BPT process:

Have a default timeout (3min) that cannot be changed.

Doesn’t have a huge logging mechanism the records that a standard BPT does, because of that, Light BPTs won’t heavily increase the processing effort and the database size.

They can execute only one single automatic activity.

To use it, the developer needs to enable the light process execution flag on the module configuration on service center:

  • Light BPT can run up to 20 parallel threads per server by default.

Ok! You have mentioned a lot of tools, but what now? How do I know which tool I need to use?

As you have already seen here the above tools are very powerful but without the understanding of how they can benefit your solutions, it might not be useful.

Let’s get a short explanation:

Timers are recommended when you need to do simple tasks (such as sending e-mails or pre-processing some data for the next day) in the background or a batch processing that doesn’t need to be executed in parallel. But you must follow a few best practices to ensure that your timer doesn’t timeout, break, or overload your server. Take a look at the Best Practices and Timers video to understand a bit better if a timer is the best way to go or not for your specific situation.

BPTs are mainly used for business process automation. As I mentioned before, one of the most common use cases is the ability to automate approval processes by adding human activities and defining your approval hierarchy in the process.

And now we come to the newest (of the three mentioned mechanisms) addition of the platform the Light BPT processes. Light BPTs are personally my first choice when we are talking about large data batches processing because they have all the benefits of a standard BPT process. Meaning that we can run parallel threads and we can launch based on a data action trigger.

But the main benefits of a Light BPT process is that they run faster for not having all the logging mechanisms attached to it, are shorter in terms of timeout in comparison with the standard BPT, are limited to one single automatic activity, that avoids the creation of huge BPT processes to be hanging on the server, and are able to run up to 20 threads in parallel which can improve a lot the processing time of the background tasks if used in the right way.

To add to that, Light BPT is a great tool to support an event-driven mechanism based on data updates, which simplifies many protocols. For example in a Producer module, I can simply expose process events to let any consumer module react asynchronously when data is created.

With this information in mind, I hope you can now start thinking more about what mechanism fits better with your solution needs.

--

--

William Antunes

OutSystems MVP, passionate about sports and a tech lover for sure! :)