How to enable Engine Memory Saving mode in BusinessWorks 6.X and BusinessWorks Container Edition

In context where large chunks of data have to be processed (large files, large SAP Idocs, large messages, …) memory usage by the BusinessWorks engine can be high but the Engine Memory Saving mode, introduced in BusinessWorks 6.6, can help reduce this.

But first let’s explain what it is and how it works.

Engine memory saving mode

A BusinessWorks process if made of activities that in most cases produce an output that is used by some of the following activities.

In the example process below when a new data file is detected, it is read and parsed, then data are filtered and mapped to a temporary structure, enriched using a database and finally and output structure is created, rendered in XML format and sent in a JMS Message.

The standard behaviour of the BusinessWorks engine is to keep the output of all activities in memory (in the Java Heap) and to release memory only when the process execution is completed.

This means that even if the output from the ‘ReadParseDataFile’ activity is not used after the ‘Filter Data’ activity execution it remains in memory until the process execution complete.

It is easy to understand that memory usage is not optimal if the input file is large and the process execution is relatively long, and this is where Engine Memory Saving mode is useful.

When this mode is enabled the engine manage dependencies between activities and when it is detected that the output of a previously executed activity is no longer needed the corresponding memory block is released.

This reduces memory usage and allows the Java Garbage Collector to trigger more often, which surprisingly reduces a bit cpu usage (in the range of a few percent) as I have seen in performance tests.

Engine Memory Mode needs to be enabled at both design time and runtime.

Enabling your application for Engine Memory Mode

In Studio go to ‘Windows -> Preferences -> BusinessWorks -> Process Diagram’ and check the ‘Enable Memory Saving Mode’ check box :

Click ‘Apply’ and ‘OK’. With this option new applications will automatically be configured for Memory Saving Mode.

For existing applications you have also to update the application by doing the following :

Select the application in the Project Explorer and do a ‘Right Click -> Refactor -> Repair BusinessWorks project’ and select the ‘Update memory saving variables option’.

You can check that your application is enabled for Memory Saving Mode by opening one of its process definition files (a .bwp file), the following XML tags should be visible :

Enabling Engine Memory Mode at runtime

The property bw.engine.enable.memory.saving.mode control the activation of the Memory Saving Mode for appnodes at runtime.

It can be defined in different ways.

To manage it at individual appnode level, you can set it to true in the config.ini file of each appnode.

To manage it at appspace level, which is more convenient, you can edit the ‘appnode_config.ini_template’ (from bw/6.X/config folder), comment the following line

bw.engine.enable.memory.saving.mode=false (to be done before appnode creation) and manage the activation of Memory Saving Mode in the config.ini file of your appspaces.

Finally you can set it once for all for all appnodes of a server by commenting this property in both ‘appnode_config.ini_template’ and ‘appspace_config.ini_template’ (before appnode/appspace creation) and adding the following line at the end of the bwappnode.tra file :

java.property.bw.engine.enable.memory.saving.mode=true

In BWCE environment, this can be done by adding the following parameters to the BW_JAVA_OPTS list of options (see BWCE documentation for details):

-Dbw.engine.enable.memory.saving.mode=true

Summary

In a context where large data chunks have to be processed the Memory Saving Mode can be used to reduce memory usage. This requires the application to be enabled for this in Studio and the memory mode to be enabled in the target appnodes.

Reference information

TIBCO BusinessWorks documentation : https://docs.tibco.com/pub/activematrix_businessworks/6.6.1/doc/html/GUID-3FC2D352-17C9-4C0F-811C-97E8835F59C3.html

The blog from my esteemed colleague Aditya Wagle : https://adityawagle.com/memory-saving-mode-in-bw-6-6-x-and-bwce-2-5-x/

Engine Memory saving mode in BusinessWorks 5.X

Engine Memory Saving is also available for BusinessWorks 5.X.

To enable it simply update the ‘EnableMemorySavingMode’ property in Administrator (nothing to do at design time).

Go to your application configuration, and go to the ‘Advanced’ tab of the process archive configuration:

I work as an Architect at TIBCO on Integration products. Opinions here are my own.