# Possible slow debug window?

**URL:** <https://discourse.nodered.org/t/possible-slow-debug-window/42958>\
**Category:** General\
**Created:** [21 March 2021 13:17 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958 "2021-03-21T13:17:24Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [21 March 2021 13:17 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/1 "2021-03-21T13:17:24Z")

</div>

I am suspecting that the messages in the debug window (from the debug node) are coming slow. To test this, I made a simple python counter. The output in the terminal is very fast, while in the debug window it arrives with a delay of 1-1.5 seconds. As I am using those messages to trigger events, everything is slowed down.

this is my main block:

![Schermata 2021-03-21 alle 14.25.35](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/5/0527f48117387c4d3521539ca3c1a0a2835ec7e1.png)

The link-out node is connected to a sort of 50-60 different flows. Could they be too much?

Where am I wrong?

---

<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:** [21 March 2021 13:35 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/2 "2021-03-21T13:35:23Z")

</div>

> [@fmarzocca](#):
>
> As I am using those messages to trigger events, everything is slowed down.

How are you using debug output messages to trigger events?

Is the browser running in the same machine as node-red?

Is the processor being overloaded while this is going on?

---

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [21 March 2021 13:38 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/3 "2021-03-21T13:38:28Z")

</div>

Hi Colin.

Not really using the "debug" window, but as you can see from the sketch in my post, I have a link-out node connected to other 50 flows. The debug window is displaying messages very slow, and they are delivered slow to the other flows.

The browser is running on another machine and the processor (Raspi) has a load average of 0.5, very low.

---

<div class="post-metadata">

**Author:** ![Andrei](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/andrei/32/10446_2.png) [@Andrei](https://discourse.nodered.org/u/Andrei)\
**Post date:** [21 March 2021 13:42 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/4 "2021-03-21T13:42:52Z")

</div>

~~How about the question?~~

> Is the browser running in the same machine as node-red?

Don´t forget that the editor uses a WebSocket connection to get messages from the runtime. If the runtime is not in the same machine of the editor then it is normal that there will be a delay (messages over websockets). The messages you get in the console are not using websockets. If this is a system in production you should consider if the debug nodes should be there.

---

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [21 March 2021 13:53 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/5 "2021-03-21T13:53:25Z")

</div>

The debug window is the only mean I have to check if correct messages are flowing in the BUS.

The main flow of this project is monitoring a automation bus and then 50 flows are analyzing the result for each message, taking the right action if requested. The debug window gives me a sort of feedback.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [21 March 2021 13:59 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/6 "2021-03-21T13:59:32Z")

</div>

Once you have it working, then remove the debug. As yes it will slow things down.

---

<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:** [21 March 2021 14:00 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/7 "2021-03-21T14:00:09Z")

</div>

> [@fmarzocca](#):
>
> The debug window is displaying messages very slow, and they are delivered slow to the other flows.

So you are using the output from the MQTT node to trigger the other flows, not the debug output. Where is the MQTT broker running?

Is the python code that runs fast picking the data up from MQTT?

---

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [21 March 2021 14:01 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/8 "2021-03-21T14:01:56Z")

</div>

Yes, the python code is running as a lightning (I can monitor it in the terminal or in MQTT-explorer). Mosquitto is running on same Raspi as NR.

---

<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:** [21 March 2021 14:14 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/9 "2021-03-21T14:14:38Z")

</div>

If you remove the wire to the link node does the debug run ok? What speed are you sending data?

---

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [21 March 2021 14:27 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/10 "2021-03-21T14:27:04Z")

</div>

I will make the "remove wire" test asap (now the system is in production). Data is sent at variable speed, from 10 frames/second to 1 each 10 seconds..

---

<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:** [21 March 2021 14:49 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/11 "2021-03-21T14:49:16Z")

</div>

> [@fmarzocca](#):
>
> this is my main block:
> 
> ![Schermata 2021-03-21 alle 14.25.35](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/5/0527f48117387c4d3521539ca3c1a0a2835ec7e1.png)

@fmarzocca just an observation (not likely to cause any significant issue) but you should not start a topic with `/` See best practices [here](https://www.hivemq.com/blog/mqtt-essentials-part-5-mqtt-topics-best-practices/)

---

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [21 March 2021 14:49 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/12 "2021-03-21T14:49:38Z")

</div>

> [@Colin](#):
>
> If you remove the wire to the link node does the debug run ok?

Yes. It is very fast. So the problem is related to the link towards the other 50 flows, each of one starting with a switch node to intercept its related frame. I'm out of ideas now.

---

<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:** [21 March 2021 14:50 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/13 "2021-03-21T14:50:50Z")

</div>

> [@fmarzocca](#):
>
> Yes. It is very fast. So the problem is related to the link towards the other 50 flows

What are these 50 flows doing? Heavy computation? How big is the payload?

---

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [21 March 2021 14:52 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/14 "2021-03-21T14:52:32Z")

</div>

The flows are intercepting a frame and use it to trigger automation (lights/scenarios/blinds/curtains/etc..) Many of them are complex as they are sending status queries.

---

<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:** [21 March 2021 14:56 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/15 "2021-03-21T14:56:19Z")

</div>

> [@fmarzocca](#):
>
> The flows are intercepting a frame

Is this "frame" 2 bytes, 1000000 bytes?

I ask because there will be 50 clones due to how you have arranged things.

What is "sending status queries" ? using what nodes? how big are the payloads?

If you dont say, we cant really help you realise if any of them are "blocking" or offer you alternative patterns to try out.

---

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [21 March 2021 15:11 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/16 "2021-03-21T15:11:00Z")

</div>

It's not easy to answer to some of your question....

The frame is short (from 6 to 10 characters).  
Sending a query can be "_ask to the burglar alarm which is its status, and wait for 10 frames as an answer for all zones_" or maybe "_check the status of the window contact_"

Used nodes are mainly switch, change and tcp request (to send messages). Few (but simple) custom functions.

Flow.json is 500KB

---

<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:** [21 March 2021 15:18 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/17 "2021-03-21T15:18:38Z")

</div>

If you run top (with the flows connected obviously) how much CPU are node-red and/or node using?

---

<div class="post-metadata">

**Author:** ![fmarzocca](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fmarzocca/32/35901_2.png) [@fmarzocca](https://discourse.nodered.org/u/fmarzocca)\
**Post date:** [21 March 2021 15:21 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/18 "2021-03-21T15:21:31Z")

</div>

ranging from 0.4 (quiet state) to 3.4/3.7 on heavy load

---

<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:** [21 March 2021 15:24 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/19 "2021-03-21T15:24:27Z")

</div>

> [@fmarzocca](#):
>
> Sending a query can be " _ask to the burglar alarm which is its status, and wait for 10 frames as an answer for all zones_ " or maybe " _check the status of the window contact_ "

What does wait 10 frames mean? Are you looping? Or doing something that is "blocking".

Based on what I've read in this thread - that looks like a strong possibility.

Could you share a flow?

---

<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:** [21 March 2021 17:27 UTC](https://discourse.nodered.org/t/possible-slow-debug-window/42958/20 "2021-03-21T17:27:56Z")

</div>

It is odd that something appears to be blocking the nodejs message loop, but not consuming CPU. Assuming that is actually happening.

@fmarzocca can you see that the messages are being delayed by some other action they have rather than seeing output in the debug node?

[Next page](https://discourse.nodered.org/t/possible-slow-debug-window/42958.md?page=2)
