Value changed script delay

Hello,

I'm facing with a strange behave and I have no idea how to identify the cause.
-- Ignition 8.1.35 with 6GB RAM allocated (8GB total) and 4 CPU 2.97 GHz in virtual environment --

on some OPC tags value changed scripts are in place that are inserting the tag value in an SQL
the problem is that from the moment when the value are changing (I can see it the tag Timestamp parameter) and the moment when the script are executed we can see a delay of 2-5 minutes and obviously in this time the value can change multiple times and we are losing data

on the status page I see Clock drift events recorded in every 1-3 hours but the delay is happen constantly

can anybody give some ideas how to catch the cause of this issue?

thank you.

This is a task that takes too long to do directly in a tag event. Use the store and forward engine or use a gateway tag change event (in the project, not on the tag). See this recent topic for why this is true:

If you have very dynamic requirements, such that the event must originate on a tag event, this topic of advanced techniques might help you:

1 Like

sorry but I'm confused a bit . As far as I know the store and forward are enabled for all data connections. What I need to do additionaly?

Scripted database operations do not use the store and forward engine unless the script function has "SF" in its name, and naturally that only applies to updates. (The store and forward engine can't do queries.)

https://docs.inductiveautomation.com/display/DOC81/system.db

Enabled, but only used by default by the historian, and by transaction groups. And the latter can be configured to bypass the S&F subsystem.

is there a way to see what scripts ar more resource consuming?

As noted in those other topics, using java's System.nanoTime() to obtain timing information in your scripts will help you identify the problems. But I'd first just search for system.db., system.tag., system.opc., and system.net. in your tag scripts. That will quickly highlight likely problems.