# Scripting architecture choices

**URL:** <https://forum.inductiveautomation.com/t/scripting-architecture-choices/56976>\
**Category:** General Discussion\
**Tags:** ignition81\
**Created:** [March 8, 2022, 7:09pm UTC](https://forum.inductiveautomation.com/t/scripting-architecture-choices/56976 "2022-03-08T19:09:59Z")\
**Posts on this page:** 9\
**Page:** 2

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 8, 2022, 9:54pm UTC](https://forum.inductiveautomation.com/t/scripting-architecture-choices/56976/21 "2022-03-08T21:54:52Z")

</div>

> [@Kevin.Herron](#):
>
> @pturmel prefers the gateway tag change script mechanism because there’s no queue

Yes, that is one reason. But not the only reason.

> [@Kevin.Herron](#):
>
> But there’s also a possibility of backing yourself up into running out of memory and crashing your gateway.

This is easy to monitor and proactively adjust hardware resources. And easy to explain to a pointy-haired-boss after they decline to spend the money.

Compared to checking the missed event flag in every single script _just in case_ you land in a tight corner and data mysteriously doesn't get recorded or state machines mysteriously get into strange states. Uh huh. Not for me, thank you very much.

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [March 8, 2022, 10:01pm UTC](https://forum.inductiveautomation.com/t/scripting-architecture-choices/56976/22 "2022-03-08T22:01:14Z")

</div>

@pturmel The client I am doing this for is a multi-billion $$ business and they _still_ send us Autocad drawings made with a pirated version of the Student Edition.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [March 8, 2022, 10:02pm UTC](https://forum.inductiveautomation.com/t/scripting-architecture-choices/56976/23 "2022-03-08T22:02:07Z")

</div>

> [@pturmel](#):
>
> Compared to checking the missed event flag in every single script _just in case_ you land in a tight corner and data mysteriously doesn’t get recorded or state machines mysteriously get into strange states. Uh huh. Not for me, thank you very much.

Totally understand. Depends on your needs.

When the queue starts overflowing the _oldest_ events are discarded, so you eventually execute with the most recent set of values up to the current value. For some applications this is okay, others it might not be.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [March 8, 2022, 10:05pm UTC](https://forum.inductiveautomation.com/t/scripting-architecture-choices/56976/24 "2022-03-08T22:05:21Z")

</div>

@pturmel converted me to gateway tag change event scripts

[Tag Value Change Scripts: Are They Run Asynchronously? - Ignition - Inductive Automation Forum](https://forum.inductiveautomation.com/t/tag-value-change-scripts-are-they-run-asynchronously/53749/16)

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [March 8, 2022, 10:07pm UTC](https://forum.inductiveautomation.com/t/scripting-architecture-choices/56976/25 "2022-03-08T22:07:17Z")

</div>

And there is no way to extend this queue?

In my case the event change signals the completion of a task. The machine has written its final values and is now waiting for the next command. As such I can easily accept a 1 or 2 or 3 second delay before the data is actually recorded in the DB.

And because each task is unique, I can’t just use the values of the latest event.

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [March 8, 2022, 10:09pm UTC](https://forum.inductiveautomation.com/t/scripting-architecture-choices/56976/26 "2022-03-08T22:09:00Z")

</div>

> [@Tag Change Missed Events](https://forum.inductiveautomation.com/t/tag-change-missed-events/37764/5):
>
> You can add this property as an additional parameter in ignition.conf: -Dignition.tags.scriptqueuemaxsize=10 I would verify that you’re actually missing events first by printing a warning if that missed even parameter is set.

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [March 8, 2022, 10:09pm UTC](https://forum.inductiveautomation.com/t/scripting-architecture-choices/56976/27 "2022-03-08T22:09:48Z")

</div>

Note I only skimmed this topic, that pertains to tag events so may not apply to the gateway limit

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [March 8, 2022, 10:22pm UTC](https://forum.inductiveautomation.com/t/scripting-architecture-choices/56976/28 "2022-03-08T22:22:31Z")

</div>

> [@peter](#):
>
> In my case the event change signals the completion of a task. The machine has written its final values and is now waiting for the next command.

This is significant. If the event can't fire until the machine runs another cycle, and the command to run another cycle is part of or otherwise linked to the data recording you do in your event script, then the architecture itself prevents more than one event being "in flight". Effectively, that is a handshake. That one almost certainly can be defined on the tag (in the UDT).

If you have events that record data repetitively and relatively quickly during a machine cycle, that's where you can get trouble. Also note my advice in the post @dkhayes linked: anything over single digit milliseconds is just too long for an event defined on a tag. Even if you don't have a problem with **that** tag, you could push another tag's requirements over the edge.

IMNSHO, tag events have too much opportunity to interfere with each other to handle any complicated task. Use gateway tag change events for anything important.

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [March 8, 2022, 10:27pm UTC](https://forum.inductiveautomation.com/t/scripting-architecture-choices/56976/29 "2022-03-08T22:27:20Z")

</div>

The machine commands aren’t linked to my data recording. So the machine will happily start the next command without me recording the data from the just finished command. Murphy says that this will occur with enough machines being monitored which will eventually lead to an event missed situation.

I do record repetitive data, but that is handled by a GW Timer script.

I guess I should add a third goal of being more robust in my recording of data.

And I believe all of my scripts are running in single digit ms

[Previous page](https://forum.inductiveautomation.com/t/scripting-architecture-choices/56976.md?page=1)
