This custom function helps to get the available heap statistics during too many user uploads/downloads or during trigger execution. The real use of the function comes when the servers responds slow. In order to get the available heap details need to use below two custom functions;
a.GetUsedHeapInMb b.GetMaximumHeapInMb
Downloads
Source code and build instructions
How to get the available heap using custom function
Let me now show you how to implement that. In order to get the available heap need to use below tow custom functions.
1. Create a trigger to get the statistics of the available 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.
Along with custom message use the below expression to print the available or free memory.
%Subtract(GetMaximumHeapInMb(),GetUsedHeapInMb())%
In order to use the function , Click the Functions button and select the Sub, GetUsedHeapinMb,GetMaximumHeap function. If the functions GetUsedHeapinMb and GetMaximumHeap is not listed checkout whether the build (Source code and build instructions) is available.
Click OK to save the settings
That's it. Now you know how to create a trigger to log the available heap of Jscape MFT Server.