Does Node-Red write to SD card a lot?

I have a MQTT input node that goes to a gauge type UI visualization. I have no control over the rate the MQTT data comes in, and it comes in really fast (like every 50ms). I'm running Node-Red on a Pi off of SD card.

So my question is:

  1. Is Node-Red logging/saving any of this MQTT data to SD card? Does Node-Red log/write to SD simply because I have a MQTT input node? Or does it write to sd card because of the visualization? I had assumed that chart UI's maybe write to the SD card, but an instantaneous gauge UI might not? But maybe Node-Red does some saving of data in some kind of log just because?

  2. In general, does Node-Red write to SD card? If I'm just subscribing to MQTT topics and performing logic to execute stuff, is all of that writing to SD card? Any way of minimizing SD card writes?

I also have a related question about mosquitto - if the mosquitto server writes to SD card a lot. A lot of my use cases are Mosquitto + Node-Red running off SD card, and I wonder about the longevity of that. Do QoS settings effect SD card writes?

If you have Retained topics that are being written to then the MQTT server will write that data in order that it is available after a restart, but you can specify how often it saves it, or at least you can with mosquitto MQTT server. I think the default is to write every 5 minutes (and it writes at a normal shutdown). If you have not got retained topics then it will not write to the SD card.
In general node-red does not write any significant amount of data to the SD card unless your flow includes nodes that explicitly do that. If you run node-red from a terminal you will see what node-red logs, that usually goes to syslog.
The UI nodes keep any data required in memory.
If you have defined persistent context data in node-red then that will write to a file to save it, but you have not said that you are doing that.

Thank you!

In addition, yes both Node-RED and Mosquitto keep permanent logs on the Pi. However, normally, the MQTT-in node will not write to the Node-RED log unless you have changed the log level.

In respect to the wider question of the reliability, if you have a good card of a fairly large size and a reasonable power supply, you can expect years of service from the card on a Pi. I know, mine have been running for several years now and I have a lot more than just NR and Mosquitto running.

I've always found the Samsung EVO and EVO Pro cards to be excellent quality. I use 32GB cards, not because I need the space, but rather because that gives loads of room for the built-in wear levelling routines.

Having a poor power supply may mean OS crashes or unexpected reboots which will also put additional strain on the card - though I believe the latest version of Rasbian no longer really has an issue with that.

If you really want to minimise card use, start by turning down or off logging for services including NR and Mosquitto. You could also consider changing log destinations to a memory file store, there are tutorials on that. However, personally I wouldn't bother unless you are really desperate.

1 Like