See information about the latest product version
Handling large input messages
Although a message flow developer cannot usually change the size of the input data or the model that leads to large memory usage, they can influence how much of a message is actively storied in memory at the same time.
In previous examples, fully parsed message trees were discussed. A standard full parse of a message tree parses a bitstream from start to finish, and fully inflates the message tree in memory. When this process produces a large message tree, large message handling techniques can be implemented to reduce memory usage.
- Using partial parsing to parse the bitstream in a message tree.
- Parse the first repeating record with a reference variable (see References & navigating the message tree for more information).
- Move to the next repeating record and delete the parent field of the previous record.
By deleting the parent field of the record after it was processed, the elements that were being used for that record are made available to the parser to use again. This behavior means that when the next repeating record is fully parsed, it reuses the same underlying message tree field objects instead of creating new ones. Using this technique means that only the memory for one record is ever used, irrespective of how many repeating records are in the input message.
- For ESQL, use the DELETE FIELD statement.
- For .NET, use the NbElement delete() method.
- For Java™, use the MbElement delete() method.
- For C, use the cniDelete() method.
- Complete or Immediate parsing on any input node.
- A trace node with ${Root} or ${Body} in it.
- The flow debugger being attached as the content of message trees and is sent to the debugger.
- Serializing a large message tree with a different codepage/encoding or validation options than it was created with.
- Copying the message tree to a different domain such as with SET OutputRoot.XMLNSC = InputRoot.DFDL. This behavior forces both the input and output trees in their entirety to be in memory at the same time
In summary, large message handling techniques can reduce how many message tree fields are in memory at the same time. Deleting fields does not apply only to repeating fields, it can also apply to any message tree field. Because the DELETE FIELD command has an overhead when the field is removed from the tree hierarchy, a message flow developer might not want to do this for every field that is ever referenced.