Loop step taking long time

Hi!

I got a workflow that is comparing two sets of data, specfically a set of Computers in IVM against our AD.
What I’ve done is, I export all computer objects from a specific OU and store them in a GA. It then grabs the set of computers from IVM, it then goes into a loop step where it checks each asset from IVM to see if it exists in the GA. That’s basically it. I’ve noticed though that it takes almost 1 min per itireration.
I found when I did some testing and limit my IVM extract to 10 assets it would loop and complete all 10 in less than 2min, but when I did a full extract which is about 1700 assets the loop step seems to take a lot longer?

Is there a better way to do this? I’m surprsed that it takes so long for the loop step since it’s basically just cheking the GA for the asset and then there is a decision step and if it’s not found it adds the hostname of that asset to a Artifact and that’s it.

Right now loop execution has an exponential effect in the amount of time each iteration takes. While this is being looked into it may be a good idea to look at other methods of comparing the two sets of data, especially for larger datasets.

One method may be to use steps similar to THIS WORKFLOW. The Type Converter step Array Diff can take two arrays of strings and give you the difference between the two of them. You can then take the difference from the previous step and use the array match action to compare it with the master list(AD or IVM) to get the assets that aren’t in the other list. Again this depends on both datasets being a list of strings so you may have to massage the data to get something useable here.

Another possibility would be to use the jq plugin to compare both datasets. This requires an advanced understanding of JSON and the operators that jq uses, but could be done with an example and statement like this: echo -n '{"all":["A","B","C","ABC"],"some":["B","C"]}' | jq '.all-.some'. Just bear in mind you will need to convert the string output of the jq action to an object before using it in any meaningful way further on in the workflow. This can be done with the Type Converter plugin.

1 Like

Thanks Eric, I ended up doing some tweaks to the workflow to narrow the amount of loops and that has sped it up to an acceptable runtiime.