The following type of Flow code is very common, but I have hit a significant performance issue with it:
Doing some performance testing, I found that if the document is large (say 20Mb) with many fields, then this test can take 200-300 milliseconds! Clearly WebMethods is not just checking for the document’s presence in the pipeline - I assume it is converting the entire document to a string representation prior to carrying out the test, which would explain why tests like the following work:
The same performance hit occurs for evaluated labels e.g.
%theDocument% == $null.
While the Service Development guide does state the variable being tested must be a String or “constrained” Object, it seems surprising that WM can’t efficiently handle a simple null test for a document.
I am aware of couple of workarounds:
- Instead of checking whether the document exists, check for a document field we are confident will have a value if the document exists. This is fast.
- Call a Java service that checks for the document’s presence in the pipeline (bizarrely yes this would be faster if workaround#1 can’t be relied on).
Has anyone else encountered this behavior? How did you resolve it?