This custom trigger function helps to get the maximum heap in MB on run time. This custom function helps to get the statistics during too many user uploads/downloads or during trigger execution. This custom function is used along with other custom function GetUsedHeapInMb where both can be compared during server slowness.
Downloads
Source code and build instructions
How to get the used heap using GetMaximumHeapInMb Function
Let me now show you how to implement that.
1. Create a Trigger to get the statistics of the Maximum Heap
Login into admin console of JSCAPE MFT Server > Triggers and Click Add to create a Trigger
Give the trigger a Name and then select the Current Time event type from the drop-down list.
Click Next to Step 2 where a condition can be set to execute the trigger.
Consider an example that the Jscape Server is too busy (from 22 Hours to 23 Hours) in processing the tasks on a specific time in a day. The slowness of the server can be due to excess heap usage (one of the reason for slowness).
In order to debug and know about the heap statistics we need to get the heap usage. Hence in the expression add the condition to be as;
Hour=22 AND (Minute=0 OR Minute=15 OR Minute=30 OR Minute=45)
The above expression indicates that the used heap value should be logged from 22 Hours to 23 Hours scheduled with a interval of 15 minutes.
Once the condition is set Click Next to proceed
The step 3 asks to add an action, Add the action "System Out" from drop down list, to print the statistics to the domain logs
Click OK to proceed
The Parameters for the action "System Out" is;
- Message
As the name indicates, Message is where you want the server to log.
For example as below;
Along with custom message use the GetMaximumHeapinMb function to log the maximum heap allocated. In order to use the function , Click the Functions button and select the GetMaximumHeapinMb function. If the function is not listed checkout whether the build (Source code and build instructions) is available
In order to print the used heap checkout the custom function GetUsedHeapInMb
Click OK to save the settings
That's it. Now you know how to create a trigger to log the maximum heap of Jscape MFT Server.