Hello Thmanampudi Lokesh Parameswara Reddy,
It depends on different things which action suits your use case the best, mainly it has to do with timeliness and synchronous or asychronous results;
But what you can try and test for yourself is the following:
Scenario 1 Start/End Transaction:
Add an start transaction before your retrieve and after your merge
Add an end transaction after your commit of the list
Scenario 2 Start/End Transaction with TaskQueue
Keep the above start and end transaction but create a submicroflow of the change in the loop and execute this in a taskqueue
Remove the commit from your flow and add it to the submicroflow
Scenario 3 Task Queue without start end transaction
Remove the start and end transaction from your flow
Scenario 4 create an entity with attributes offset and amount
retrieve the number of records that you need to change and count the records.
Then divide the count by the amount this is the number of badges you need to do.
Then create the object equally the number of badges and make sure you add up the offset on the objects
Then within your sub microflow that you use as a taskqueue put the retrieve of the testing and a loop so similar to the microflow you have now but with the change that it listens to the object with the amount and offset for retrieving the batches
These are some ways to see what it helping the performance and prevent your app from crashing.
Eventually, you could also use a scheduled event to not process everything at once but with pauses in between.
Hope this helps,
Good luck!
To expand on Jelle's answer, your microflow is not performing true batch processing. The reason is that in Mendix, a (database)commit only takes effect when the microflow completes. This means that all pending commits are retained in memory until the microflow finishes. Consequently, if you structure your flow in this manner, you risk running out of memory as these uncommitted objects accumulate, causing your application to crash and restart.
For more details on how commits work in Mendix and to understand the implications for memory usage, refer to Chapter 5 of this guide: