# Deployment time is long

**URL:** <https://discourse.nodered.org/t/deployment-time-is-long/41596>\
**Category:** General\
**Created:** [25 February 2021 02:13 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596 "2021-02-25T02:13:12Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [25 February 2021 02:13 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/1 "2021-02-25T02:13:12Z")

</div>

Hi,

My Node-RED application has 5 flow and 8 subflow, when exporting all in JSON format the total size is 1.25 MB.  
Each time I click the Deploy button, it takes a long time to complete, about **9 minutes** each time.  
I think that the deployment time is long, right?

In the project, subflow calls each other, for example subflow A calls subflow B and subflow C, subflow B calls subfow D (because subflows contain common part of flows)  
Could calling between subflows like this cause the long deploy times?

You has met or has experience in this situation please tell me!  
Thanks!

Node-RED version: v0.20.7  
Node.js version: v12.7.0  
OS: Windows 10 build 1909

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [25 February 2021 08:33 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/2 "2021-02-25T08:33:56Z")

</div>

> [@minhhn0205](#):
>
> Node-RED version: v0.20.7

I dont think it is even worth exploring any potential issues until you update. V0.20.7 is **REALLY** old. I would strongly suggest updating to latest version (see docs).

PS: are you doing full, flow or node deploy?

PS2: is the CPU maxed out by other processes?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [25 February 2021 09:17 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/3 "2021-02-25T09:17:35Z")

</div>

The usual cause of a hang like this will be a node taking some time to stop.

If you set the logging level to 'trace' in your settings file, then you should see a lot more detail on what is happening during the deploy. You should see a log statement for when it asks each node to stop, and another when each node has stopped.

It will take some work to do - but you should be able to narrow down what node (if any) is causing the delay.

That said, I simply can't remember if 0.20.7 has those log statements in or not - you'll just have to try.

---

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [26 February 2021 00:36 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/4 "2021-02-26T00:36:17Z")

</div>

@Steve-Mcl, @knolleary Thank you for your support!

This means that subflow calls are not the cause of time-consuming deployments!!!

> [@Steve-Mcl](#):
>
> I dont think it is even worth exploring any potential issues until you update. V0.20.7 is **REALLY** old. I would strongly suggest updating to latest version (see docs).

Yes, I will update later...

> [@Steve-Mcl](#):
>
> PS: are you doing full, flow or node deploy?

I deploy full.

> [@Steve-Mcl](#):
>
> PS2: is the CPU maxed out by other processes?

This is not clear to me, I open PC and work mostly with Node-RED.  
But I also have a question that the Node JS service takes up very high memory 1,7GB ～ 3,1GB.  
Is this unusual?

 ![memory_NodeJS](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/4/74b1cff4530a73f21bd2ef2c7f05b513f42cda02.png)

> [@knolleary](#):
>
> The usual cause of a hang like this will be a node taking some time to stop.
> 
> If you set the logging level to 'trace' in your settings file, then you should see a lot more detail on what is happening during the deploy. You should see a log statement for when it asks each node to stop, and another when each node has stopped.
> 
> It will take some work to do - but you should be able to narrow down what node (if any) is causing the delay.

I also think there is a possibility that some node makes deploying long,  
but in the project there are too many nodes, manual shrinking takes time,  
so is there a way to output the deploy time log file of each node?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [26 February 2021 01:00 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/5 "2021-02-26T01:00:26Z")

</div>

> [@minhhn0205](#):
>
> I deploy full

Change to deploy node method.

> [@minhhn0205](#):
>
> Node JS service takes up very high memory 1,7GB ～ 3,1GB.  
> Is this unusual?

Depends how many nodes of your flows & what they do. Could also be an issue with that old version.

When was the last time you restarted node-red?

---

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [26 February 2021 01:34 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/6 "2021-02-26T01:34:27Z")

</div>

> [@Steve-Mcl](#):
>
> Could also be an issue with that old version.

It is also possible that this is a possibility ... (y)

> [@Steve-Mcl](#):
>
> When was the last time you restarted node-red?

I just restarted Node-RED, complete memory about 1.7GB  
Then:  
① I go to subflow ＞ double click on the catch node, check 2 more node names, the purpose is to change the catch node.  
② Change [deploy full] to [depoy node]  
③ Click the Deploy button

After clicking the Deploy button, the memory increases continuously, up to about 4GB ～  
 ![111](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/c/8c8ddbec1c48e4c04d19599a69ed8dd42030706e.png)

The total deployment time has not changed much compared to [deploy full] **8 minutes** ～ **9 minutes**

After deploying completed, memory decreased  
 ![222](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/a/5a1b3baf91e359e4d39e34ab2e319a2b9bb2828d.png)

---

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [26 February 2021 05:10 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/7 "2021-02-26T05:10:23Z")

</div>

> [@Steve-Mcl](#):
>
> Change to deploy node method.

Only the first time is long,  
from the second time on, the deploying time is very fast, thank you very much!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 February 2021 09:19 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/8 "2021-02-26T09:19:05Z")

</div>

That is only a workaround, the fact that it is so long for a full deploy means there is an issue somewhere that should be addressed.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [26 February 2021 09:22 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/9 "2021-02-26T09:22:47Z")

</div>

> [@minhhn0205](#):
>
> so is there a way to output the deploy time log file of each node?

If you watch the log when you hit deploy you should be able to see a long pause somewhere between log events saying what nodes have stopped.... that should be all the information you need to identify which nodes took a long time.

---

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [26 February 2021 20:17 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/10 "2021-02-26T20:17:48Z")

</div>

@Colin

> [@Colin](#):
>
> That is only a workaround, the fact that it is so long for a full deploy means there is an issue somewhere that should be addressed.

Yes, as you said, the root issue has not been addressed.

> [@knolleary](#):
>
> If you watch the log when you hit deploy you should be able to see a long pause somewhere between log events saying what nodes have stopped.

I know how to output the start and end time of a node's execution at runtime,  
but I don't know how do I calculate the start and end time at the deployment time of a node.  
I tried google search but no result, if you know, please tell me or any hint will be great!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 February 2021 21:11 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/11 "2021-02-26T21:11:59Z")

</div>

> [@minhhn0205](#):
>
> t I don't know how do I calculate the start and end time at the deployment time of a node.

Have you followed this advice:

> [@knolleary](#):
>
> If you set the logging level to 'trace' in your settings file, then you should see a lot more detail on what is happening during the deploy. You should see a log statement for when it asks each node to stop, and another when each node has stopped.

---

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [26 February 2021 21:34 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/12 "2021-02-26T21:34:19Z")

</div>

Sorry, I missed that advice ☹  
I've just done, and am wondering if the time column in the red frame is the start time to deploy each node?

 ![node-red-trace](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/1/113cdec65fe2eaa33a1dd6a289724dda99b34a2e.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [26 February 2021 21:42 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/13 "2021-02-26T21:42:50Z")

</div>

I think the idea is that you watch the log while you deploy. At some point it will stop for most of 9 minutes. Hopefully you will be able to see from the log at that point what is trying to do. Copy the last lines from the log and paste them somewhere. Also hit enter a few times which will put some blank lines on the screen. Then when it starts again you will be able to scroll back and find where the pause was so you can see what the first lines after it got going were.

---

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [26 February 2021 22:39 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/14 "2021-02-26T22:39:48Z")

</div>

@Colin Thank you for your support!  
I will follow the instructions to investigate further, if there is anything new I will notice.

---

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [1 March 2021 06:20 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/15 "2021-03-01T06:20:52Z")

</div>

I set the output log 'trace' to the file  
＞ Then start Node-RED  
＞ Switch deploy to [deploy full]  
＞ Change the node and click Deploy, after deploying complete see 'trace' log, the whole time will be output in succession without any interruptions, like below (1 part of log, all about 332502 rows)

 ![logs_deploy](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/1/7127f682d9f4b3bdabd57d774c06450c251bd698.png)

I wonder if there is any way to confirm anymore...

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 March 2021 07:36 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/16 "2021-03-01T07:36:30Z")

</div>

Do you mean it keeps outputting for the whole time the delay is happening with no time gaps?

---

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [1 March 2021 07:46 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/17 "2021-03-01T07:46:29Z")

</div>

I look at the entire log and see the time being output continuously, I don't see the log like below (for example):

> 1 Mar 09:06:56 - [trace] [subflow:25436416.26e7bc] cbc01a96.6ed9d8 | switch | d8108a4e.4a0968  
> 1 Mar 09:06:56 - [trace] [subflow:25436416.26e7bc] 93cfb67e.047998 | switch | 42be4977.14afd8  
> **1 Mar 09:06:56** - [trace] [subflow:25436416.26e7bc] 60a5ac71.f3b3c4 | template | fc1267b3.9df868  
> **1 Mar 09:10:56** - [trace] [subflow:25436416.26e7bc] d63fb64a.d56c18 | postgres | 828e0c62.ea943  
> 1 Mar 09:10:56 - [trace] [subflow:25436416.26e7bc] b0d25e0c.df6c3 | comment | 2fb4eea3.21bf42  
> 1 Mar 09:10:56 - [trace] [subflow:25436416.26e7bc] c65bdd41.a5b0d | function | 5fb2b8.2cb5dd48  
> 1 Mar 09:10:56 - [trace] [subflow:25436416.26e7bc] 213814b0.42210c | function | 9b0e7103.8d318  
> 1 Mar 09:10:56 - [trace] [subflow:25436416.26e7bc] 10f947f0.250228 | change | 4c971bb0.409404  
> 1 Mar 09:10:56 - [trace] [subflow:25436416.26e7bc] 934e9b45.8c5328 | change | 82ab34aa.e1c078  
> 1 Mar 09:10:56 - [trace] [subflow:25436416.26e7bc] 972ab629.a32c38 | change | d3af803b.53e08

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 March 2021 08:10 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/18 "2021-03-01T08:10:13Z")

</div>

So when does the delay occur? If you watch the output as it is produced by stopping node red then restarting it in a terminal at what point does the delay occur?

---

<div class="post-metadata">

**Author:** ![minhhn0205](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/minhhn0205/32/29062_2.png) [@minhhn0205](https://discourse.nodered.org/u/minhhn0205)\
**Post date:** [1 March 2021 08:55 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/19 "2021-03-01T08:55:07Z")

</div>

> [@Colin](#):
>
> So when does the delay occur?

Looking at the log I don't see any delay, the time is being output continuously.  
_P/s: Sorry if I don't understand what you mean..._

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [1 March 2021 09:00 UTC](https://discourse.nodered.org/t/deployment-time-is-long/41596/20 "2021-03-01T09:00:33Z")

</div>

In a terminal stop node red, then start it again. You should see the startup log appearing in the terminal. Watch it appearing when you deploy and note at what point the 10 second delay happens.  
If the output does not stop but just keeps going for the full 10 seconds post it here as an attachment using the Upload button to attach it to your post.

[Next page](https://discourse.nodered.org/t/deployment-time-is-long/41596.md?page=2)
