performance impact with appendToDocumentList

Hi

i have a dought that how the performance impacts by using more appendToDocumentList servies in flow.

Regards,
Chandrasekhar

My testing on 6.1 version showed that performance became a significant factor after a few hundred items (700-800 as I recall) were added using appendTo… services. Where performance drops off in a particular IS environment may vary.

This is due to how a list is managed. A list is implemented as a Java array. When another item is added to the list, a new array, original array length + 1, is allocated and the references from the original array are copied over.

I have not investigated whether this behavior has been changed in 6.5 or 7.x.

If the list is expected to grow beyond a few hundred entries, I would suggest using alternate facilities to create the list rather than using document list using appendToDocumentList. For example, you might use ArrayList (or other appropriate collection class–I’ve used LinkedList in the past) to build up the list, then convert it to a document list (a Java array) for subsequent use.

Have you seen any sample code that uses the System.arraycopy instead of the for loop? Would the PSUtilities addToList act as a substitute, or does it have the same issue?

I have a map that uses appendToDocumentList to an extreme within nested loops. knowing now what I didnt know then I would never do this. However, the bed is made.

I do not know for sure but I imagine that arraycopy is used by the appendTo* services. The slowdown presumably is also due to the array allocations as well.

Hi,

Its has been documented in webMethods performance guide to avoid using appendtodocumentlist service for more than few hundred records. The alternative is to use the services from PSUtilities packages. We have been using the services from PS Utilities packages from last couple of months and its has drastically improved our performance. Check out this SR:

https://advantage.webmethods.com/advantage?targChanId=kb_home&oid=1612236666

Hi,

Does anyone have idea on how does ‘appendToDocumentList’ performance fare with newer version 8.x

Do we have to still create java service to perform this task, or can we use the service in WmPublic.

Cheers,
Pramod

My experience with this is that appendToDocumentList is impacted more by the JVM than by the wM IS version. So depending upon which JVM you’re using you may get differing results.

You’ll probably want to run some tests in your environment to determine if the number of items you’ll typically deal with will have acceptable performance.