Performance consideration for calling invokeAsynchronous multiple times

I have a gateway timer that runs every 15 minutes. This function browses tags and calls system.util.invokeAsynchronous for each tag that matches certain criteria. There can be 100 - 150 such tags, so that many instances can run in parallel at every execution of timer. Function in invokeAsynchronous call queries tag history using queryTagHistory function and writes to a specific tag.

Is there any impact on gateway performance calling invokeAsynchronous in above manner? Is there any way to minimise the load?

Another thought… could you browse and then make a list of tags to pass into system.tag.queryTagHistory rather than one at a time? Then parse them back out when you get the data back?

I would have two scripts. One to gather the approbriate tags and store the names-- perhaps to a dataset or document tag. The second one to gather the names from the tag and run the history query.

@bschroeder @JordanCClark Thank you for you quick replies. I agree that methods suggested by you won’t take long to execute. Using invokeAsynchronous, I was thinking to update all tags in at almost same time.
But in general, is there any limit on number of invokeAsynchronous simultaneous calls can be made?

Yes there is an impact. The processor is only capable of handling so many things at once (e.g. there is a limit to how many threads can run simultaneously). Once that happens, the threads are queued in a schedule and eventually other things can/will start to suffer.

You can minimize the load by pooling the load, as @bschroeder and @JordanCClark pointed out.

IMO, there is no need for invokeAsynchronous here. Timer Events can be configured to run on their own dedicated thread.


Thanks @lrose for the clarification. I will try out alternative approaches suggested by @bschroeder and @JordanCClark.

Thanks again everybody!