# CPU intensive and slow restarting gateway scripts

**URL:** <https://forum.inductiveautomation.com/t/cpu-intensive-and-slow-restarting-gateway-scripts/43821>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [February 25, 2021, 10:58am UTC](https://forum.inductiveautomation.com/t/cpu-intensive-and-slow-restarting-gateway-scripts/43821 "2021-02-25T10:58:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [February 25, 2021, 10:58am UTC](https://forum.inductiveautomation.com/t/cpu-intensive-and-slow-restarting-gateway-scripts/43821/1 "2021-02-25T10:58:40Z")

</div>

Hi all, I have a gateway with 10 projects, all including the same template project. Each time I save changes to the template project, the CPU load where Ignition gateway is running gets very high (up to 100%) and in the _wrapper.log_ file the `Restarting gateway scripts` entry takes up to 6 seconds for each project as in the following screenshot:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/9/f99c36d53f9505097c0ef3245df02f55e03705c0.png)  
Is that normal or shall I have to check anything?

Thanks in advance, regards  
Pierluigi

---

<div class="post-metadata">

**Author:** ![chasondeshotel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chasondeshotel/32/20032_2.png) [@chasondeshotel](https://forum.inductiveautomation.com/u/chasondeshotel)\
**Post date:** [February 25, 2021, 2:43pm UTC](https://forum.inductiveautomation.com/t/cpu-intensive-and-slow-restarting-gateway-scripts/43821/2 "2021-02-25T14:43:39Z")

</div>

That’s been my experience. I’m curious if there’s something happening after restarting the gateway scripts that just isn’t printing to the log or if it’s batching the gateway scripts then waiting for them all to complete because it seems like they all pop up at once then it takes a bit for the next log entry to show

---

<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:** [February 25, 2021, 2:45pm UTC](https://forum.inductiveautomation.com/t/cpu-intensive-and-slow-restarting-gateway-scripts/43821/3 "2021-02-25T14:45:40Z")

</div>

Hmm. The whole “Restarting gateway scripts” thing is to be expected, but 6 seconds per project does seem slow.

---

<div class="post-metadata">

**Author:** ![chasondeshotel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/chasondeshotel/32/20032_2.png) [@chasondeshotel](https://forum.inductiveautomation.com/u/chasondeshotel)\
**Post date:** [February 25, 2021, 4:46pm UTC](https://forum.inductiveautomation.com/t/cpu-intensive-and-slow-restarting-gateway-scripts/43821/4 "2021-02-25T16:46:27Z")

</div>

@Kevin.Herron do the scripts run when they restart or is the queue separate? Would turning them all off or all off and then back on one at a time tell us anything? Or what about creating a script with just `import sys; sys.exit()` and time that?

I wish I still had access to the project where I saw this. Probably not 6 seconds a piece (I was thinking 6 seconds total) but it always seemed like that part took a while

---

<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:** [February 25, 2021, 4:48pm UTC](https://forum.inductiveautomation.com/t/cpu-intensive-and-slow-restarting-gateway-scripts/43821/5 "2021-02-25T16:48:10Z")

</div>

Change scripts will run and Jython modules will be evaluated. If you don’t check the `initialChange` flag in your change scripts then whatever they are doing may run. But that won’t be counted in the 6 seconds seen here.

---

<div class="post-metadata">

**Author:** ![kcollins](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kcollins/32/19646_2.png) [@kcollins](https://forum.inductiveautomation.com/u/kcollins)\
**Post date:** [February 25, 2021, 5:19pm UTC](https://forum.inductiveautomation.com/t/cpu-intensive-and-slow-restarting-gateway-scripts/43821/6 "2021-02-25T17:19:54Z")

</div>

If you’ve got time-consuming activities going on in your _Gateway Startup_ script, you’ll see this behavior; each startup script from the derived projects will run to completion before the restart of the next derived project scripts occurs.

---

<div class="post-metadata">

**Author:** ![pgmo](https://avatars.discourse-cdn.com/v4/letter/p/d07c76/32.png) [@pgmo](https://forum.inductiveautomation.com/u/pgmo)\
**Post date:** [March 1, 2021, 8:18am UTC](https://forum.inductiveautomation.com/t/cpu-intensive-and-slow-restarting-gateway-scripts/43821/7 "2021-03-01T08:18:25Z")

</div>

> [@kcollins](#):
>
> time-consuming activities going on in your _Gateway Startup_ script

That was the first thing I checked:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/1/81ac3a96b57ae0906ce1df98f07bff7c6463d4f4.png)  
This is my _Startup Script_ section of the _Template project_, i.e. the project that every other project in the gateway includes. As you can see, that's absolutely empty. Nothing more is programmed in the _Startup Script_ section of each single project.

> [@Kevin.Herron](#):
>
> If you don’t check the `initialChange` flag in your change scripts

I have many _ValueChanged_ script but I do check the `intialChange` flag in each _ValueChanged_ script.

Do you think an upgrade from the current **8.0.16 (b2020082513)** version to **8.1.2** could bring any advantage?

Thanks, regards

**UPDATE**  
In the Windows Task Manager I see a _Trend Micro Service_ which uses very much CPU: could that slow Ignition behavior be due to _Trend Micro_ analyzing each and every Ignition file access? Are there any folders you reccomend to add to the _Trend Micro_ folders scan exceptions?

**UPDATE 2**  
Might this be an issue?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/2/c275bd81179c678618967afc4542400b1d9c79cf.png)

**UPDATE 3**  
After switching _Trend Micro_ off, project reloading got really better

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/0/c0ab2689503c5b78f68aa2a4fa515bfc9f4d3d38.png)  
Just 3 seconds to reload 10 projects!

Therefore I have one last question: do you have a list of Ignition folders that the antivirus software should not scan, so that we can achieve better system performance?
