<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Paulo Rosário on Medium]]></title>
        <description><![CDATA[Stories by Paulo Rosário on Medium]]></description>
        <link>https://medium.com/@paulomsrosario?source=rss-ea28b2efadeb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DuGXboIlEOsDajJQWUIffQ.png</url>
            <title>Stories by Paulo Rosário on Medium</title>
            <link>https://medium.com/@paulomsrosario?source=rss-ea28b2efadeb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 11:55:03 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@paulomsrosario/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Parallel Batch Processing in OutSystems]]></title>
            <link>https://blog.product-league.com/parallel-batch-processing-in-outsystems-7e21c7756b08?source=rss-ea28b2efadeb------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e21c7756b08</guid>
            <category><![CDATA[batch-processing]]></category>
            <category><![CDATA[outsystems]]></category>
            <category><![CDATA[business-process]]></category>
            <dc:creator><![CDATA[Paulo Rosário]]></dc:creator>
            <pubDate>Wed, 05 Jun 2024 09:50:53 GMT</pubDate>
            <atom:updated>2024-08-16T08:50:02.363Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine you have a cake and your goal is for that cake to be eaten as fast as possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gCASLqbKpK_9bllBha5_hA.jpeg" /></figure><p>There are a couple of ways to solve this issue:</p><p>You can call over 5 friends and divide the cake into 5 large slices, better than eating everything by yourself but not very optimal, especially if the cake is very big.</p><p>Or you can call over 20 or 40 or 60 friends and divide the cake between them into smaller slices and eat the entire cake in seconds.</p><p>Eating this cake and processing a large amount of data in OutSystems are similar challenges.</p><p>With OutSystems we have tools in the form of timers for async processing, which have their constraints in available processing power and threads.</p><p>This can be an issue when you have a large dataset that needs to be processed and you need those resources available for other tasks. To overcome this issue we can implement a Parallel Batch Processing pattern.</p><h3><strong>What is Parallel Batch Processing (PBP)</strong></h3><p>PBP uses the power of Light Business Processes to process a large amount of data quickly and efficiently by dividing the records of the entity that you wish to process into manageable batches and processing those batches individually, asynchronously, and in parallel.</p><p>This pattern allows for a fast and universal implementation meaning that it can be adapted to any entity and case in your factory. It relies strongly on Light Business Processes so let’s talk a bit about them.</p><h3><strong>What are Light Business Processes? (LBPT)</strong></h3><p>Light Business Process or LBPT is a tool in the OutSystems platform that allows the developer to run code asynchronously and in parallel.</p><p>I will not go very deep into BPT in this article, this will be more focused on LBPTs. To learn more about BPTs please refer to <a href="https://success.outsystems.com/documentation/11/building_apps/using_processes_bpt/">official documentation</a>.</p><p>What differentiates a Light Business Process from a Business Process?</p><p>The number of processes that can be run in parallel, the conditions under which they can run, the timeout of each process, and the ability to use callbacks and logging, which can be added to the flow if needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*Him15prYNa1qgTPCU1KbjA.png" /><figcaption>Differences between BPT and LBPT</figcaption></figure><p>The number of Light Business Processes that can be processed in parallel in a factory is 20 per frontend server available, this means that a factory with 2 frontend servers can run 40 parallel asynchronous LBPTs at any given time. This translates into a great amount of processing power that can be tapped.</p><p>A Light Business Process has to be triggered by a Create Action in the Database and can only have one automatic activity in the flow.</p><p>For a Module to be able to run an LBPT the option needs to be selected in the service center otherwise the platform will consider the process as a normal Business Process.</p><p>You can access this option by going to Factory -&gt; Module -&gt; Operation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*OTEO7SXx-zwGx8Lay_tQrg.png" /></figure><p>Light BPT processes automatically restart in the event of uncaught exceptions. Error messages and debugging data are not displayed or collected.</p><p>The only way to check if a process has an error is by going to Service Center &gt; Monitoring &gt; Processes &gt; (your light BPT process).</p><p>If your process continues to fail, the platform will increase the time between attempts to a maximum of 24 hours until the process succeeds. This can lead to processes being active for an undetermined amount of time if not properly managed.</p><p>To avoid this and identify errors, it is recommended that we handle any exceptions, report them to a separate error queue, and then end the process.</p><h3>How to implement a PBP pattern?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*qN4bhTNqP6uWXoKTZVw6jw.png" /></figure><p>To implement a PBP pattern you will need:</p><p>· A <strong>timer </strong>that will split your entity into batches.</p><p>· An <strong>Entity</strong> that will store the identifiers of the table that you want to process (Control Table).</p><p>· A L<strong>ight Business Process </strong>to process your batches.</p><p>Let&#39;s run each of the elements down:</p><p><strong>The timer</strong></p><p>This is the most important part of the pattern. As with all timers, this one should follow the <a href="https://success.outsystems.com/documentation/best_practices/performance_and_monitoring/performance_best_practices_logic/">best practices</a> recommended by OutSytems.</p><p>The main objective of this Timer is to split your entity into incremented batches to store the required identifiers in your control table.</p><p>We do this by defining an Increment that will translate into our Upper and Lower ceiling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*lSGRkMaCDbmX8prbfe9QaA.png" /><figcaption>Example of a PBP Timer</figcaption></figure><p>With an increment = 100, our timer will create increments of 100 records each and save the lower identifier and the upper identifier in our control table. We can achieve this by using the <a href="https://www.w3schools.com/sql/sql_between.asp">BETWEEN </a>operator in SQL applied to a subquery.</p><pre>SELECT Id<br>FROM<br>(<br>SELECT TOP ((Lower-1)) TableName.Id Id,<br>ROW_NUMBER() OVER (ORDER BY TableName.Id) AS Seq<br>FROM TableName<br>ORDER BY TableName.Id<br>) t<br>WHERE Seq BETWEEN  Upper AND Lower </pre><p>No more data is needed from the table we are processing.</p><p>In this timer example, all the records are processed and then the LBPT is triggered when the timer is finished, this assures data consistency.</p><p><strong>Control table</strong></p><p>This entity’s only function is to store the upper and lower limits of your incremented data.</p><p>The attribute types should reflect the type of unique identifier of the entity you wish to process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*_pnyvvvEUof-Srk2iSWitg.png" /><figcaption>Example of a control table</figcaption></figure><p>If that entity has a unique identifier of the type Long Integer, your Upper Celling and Low Ceiling should be of the Long integer type accordingly.</p><p>This table will be purged every time the timer runs to minimize the impact of splitting the data.</p><p>We should also create a timer that clears the control table on command. This allows us to purge that table in case of any error.</p><p><strong>The LBPT</strong></p><p>The process is the final step in our flow, here we will process the incremented data from our database. You will also be able to add logging or any other form of tracking to your process if required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*GO3JhywUtDHTR2d7WqFaNQ.png" /><figcaption>Example of an LPBT with error handling and killswitch</figcaption></figure><p>Having a way to stop your processes is recommended to free up your threads faster if something goes wrong, here we use the same flag for the timer which assures that if the timer is disabled then the LBT is too.</p><p>Here we can use the exception handling flow to log any exceptions and ensure that the error along with any other data or metric needed for your use case. These errors can then be processed and handled at a different time.</p><h3>Use Case: Clear Log Tables in OutSystems</h3><p>Deleting a great amount of data in OutSystems is not as straightforward as on other developing platforms, especially when your factory is on the Cloud, which removes your ability to directly access your Database.</p><p>Outsytems does a great job providing automatic log tables that help with the monitoring of your system. However, due to the way these tables are handled by the platform (cyclical deletion of the older ones after some time) the volume of data stored in these tables can be very unpredictable.</p><p>In this use case, the API logging setting for this module was set to Full which means that for every call done the request header and response are saved in these logging tables. This along with very heavy responses created a situation that saturated the database to the point of having an impact on the performance of the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*_Vc5_YvRbvA238isVMBQjg.png" /></figure><p>To fix this issue, since the factory is on the Cloud, we would have to open a support ticket with OutSystems and even then, we would not have direct access to the database.</p><p>This would take time that we did not have.</p><p>First, we tried using BPT utils and DBCleanerOnSteriodsbut due to the way the application processes the data it would either timeout or we would have to delete small batches of 100 or fewer records.</p><p>This issue pushed us to develop an app that could easily handle this volume of data. You can find the foundation for that app here: <a href="https://www.outsystems.com/forge/component-overview/17027/parallel-batch-processing-sample-o11">Parallel Batch Processing Sample</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5DRn9yua_Icahw3ui4JwOw.png" /><figcaption>PBP sample APP</figcaption></figure><p>By implementing a PBP pattern that allowed us to create batches of data to delete, we were able to clear the desired tables and restore DB health.</p><p><strong>Final Notes</strong></p><p>OutSystems provides a quick video about this method of processing in their Asynchronous Capabilities in OutSystems guided path. Check it out <a href="https://learn.outsystems.com/training/journeys/async-capabilities-649/massive-data-processing-with-light-processes-light-bpt-/o11/784">here</a>.</p><p>I encourage you to test out this pattern and hopefully, it will help you in the future!</p><p>Thanks for reading!</p><p>Click here to read more about our services: <a href="https://product-league.com/services/ecommerce">https://product-league.com/services</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e21c7756b08" width="1" height="1" alt=""><hr><p><a href="https://blog.product-league.com/parallel-batch-processing-in-outsystems-7e21c7756b08">Parallel Batch Processing in OutSystems</a> was originally published in <a href="https://blog.product-league.com/">ProductLeague</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>