Node-RED scope, multi-threading and limitations

I’m an Electrical Engineer and familiar with C#, VB, PLC coding of many types. I have an application on our site that is written in C++ and it has interfaces with PLC’s via RSLinx and OPC Servers of different brands. There is Serial communications to bar code readers and there is integration to printers for production.

There are modifications to the system that are required at irregular intervals. I really like the programming approach and would love to use it directly or integrate it somehow. I’m interested in getting some feedback from those in-the-know about performance of the Node-RED environment. I’m planning on scaling this IoT programming environment to an application which has host to a number of devices (for discussion Max = 36. Usually these have separate channels, threads and a script to go along with each). I’m looking NOT to have a distributed Raspberry Pi architecture.

I was thinking of replacing the C++ application with Node-Red and using the Dashboard or similar for a multi-user interface (Max = 3) on PC’s on the line. Since Node-Red runs as a single thread, do I need to embed multiple instances in an application, and then I wonder is this really asking too much from the platform? Can I multi-thread Nod-RED?

Or, How should I approach this with Node-RED?, and/or use another environment?

Kind Regards,

Kyle, I am working on something that I think will help you quite a bit in this effort. I would love to talk to you about it but I cannot make it public yet. I cannot find a way to PM you in this new Discourse forum. Please send me an email at jmorris651 at gmail



Node-RED, being based on Node.JS/JavaScript is never going to perform like a reasonably written C++ application.

However, we don’t have enough info on whether this would be an issue to you.

Clearly, a C++ application will use a lot less resources (CPU and memory) and will be capable of a much higher throughput of transactions.

Even in regard to having 3 users, while that shouldn’t be an issue, without understanding what processing is happening, what throughput of messages, complexity, processing, etc. We can’t really offer sensible advice I feel.

However, as Node-RED is an excellent prototyping tool, you may be able to throw something together and get a feel for things yourself.

Though node.js itself is written in C++ so it does perform pretty well, and it does seem to be fairly well written :wink:

1 Like

You have not elaborated on what the environment is - but if it is an industrial environment then i would say that a Raspberry Pi is not a suitable device - performance wise it may or may not suffice, but in terms of robustness and using an SD card etc - not a good long term idea. You would be far bettter off looking at an Intel NUC with integrated SSD - either running natively, or as a Docker container - or my preference as a Virtual machine to allow rapid recovery, online backups (snapshots) etc


Sorry, not trying to “diss” Node.JS. It is a fantastic tool for all sorts of things. It is, of course, based on the V8 JS engine that I guess is probably mainly written in C++

However, my comments stand & we still don’t know the actual needs of the OP.

To reiterate, NOT Raspberry Pi… NOR a distributed system. I’m actually wanting to set the VM on a HP Workstation. Windows 10 for the OS for Node-RED. ( Either that or Ubuntu) . The OS needs to host OPC Servers and Serial port expanders to Serial devices on our network.

My question is about throughput for all the channels combined and multi-threading. Not so much the need of a large or small computer to support Node-RED.

I am going to implement the program with Node-RED and see what happens with throughput as a proof of concept. I just wanted to know if anyone had a similar experience and multi-threading was used, or possible to implement with ease.

Kind Regards

click on the name or image and then click Message


Don’t forget that Node.JS is aimed at “microservices”. Since it is essentially single-threaded, typically you would look to implement horizontal scaling (e.g. multiple instances) to get performance. Not so easy though when it comes to hardware - especially serial port - integration.

At the moment, Node-RED’s capabilities for horizontal scaling are limited - though I remember that some people have done it. Improvements are on the roadmap I believe - namely a clearer split between the admin and the runtime components.

Running on a VM hosted on a desktop PC could potentially further restrict throughput since this is not really the expected use-case for a desktop. In addition, VM’s can sometimes suffer performance limitations when it comes to hardware-specific throughput. Sorry, a bit vague there as this isn’t really my area of expertise, more going by what I’ve heard.

I would, certainly, choose Linux rather than Windows as my choice of host for Node-RED however since it has a reputation for higher throughput on the same hardware. Also, there appears to be a lot more familiarity with running Node-RED (and Node.JS in general) on Linux in the help forums.

That would seem to be the sensible approach.

You can also quickly scale multiple instances of Node-RED across CPUs using PM2’s cluster mode. Pretty easy to setup.
With that being said we usually process alot of information using only a single instance on a Raspberry pi without issues. What kind of bandwidth are you looking at?

The bandwidth limitation would be on the devices connected to Node-RED. It may not be an issue, but I would like to get some idea if I can isolate into threads a number of TCP/IP inputs from Cognex scanners. (There can be up to 20 Cameras, and other Serial Devices etc. worst case,) I need to make sure they are not impeded when it comes to data throughput. It may not be a factor of the programming environment at all, but before I make a huge effort to do this in Node-RED, I’d like to get an idea if I can isolate these into at least a few channels and if that means 2 or 3 PC’s (Raspberries, etc.) working in conjunction, so be it.

I would like to know more about “PM2” and “Cluster Mode”, of which, I have no idea of these you refer.

PM2 is process manager for Node.js (or any other process) that can be used to launch Node-RED. It features a cluster mode that will launch processes on separate cores. It also acts as a watchdog and will restart the process if it crashes. Nice thing is that it works on all platforms.


Ok, I was googling and found this…
node-red-contrib-mp-function 1.1.1
Multi-threaded function node for NODE-RED


node-red-contrib-mp-function is based on original IBM function node.
You need to see it basic usage at first. This node allows you to run your
hardcore calculation code in separate process (or some of them) without
freezing of node-red process and your other precious flows.

So, It looks like there is a means to push activity into a side thread, or multiple side threads. After reading this basic explanation under the “Flows” page, I still need to dig into it to see if it, or something else is going to be able to isolate work in other side threads. Maybe not communicating to scanners. It looks primarily for calculations/processing. But maybe so… I’m looking into it.

Please amplify on this if you can.

You could also consider, like I have done, to write specific services in Python and use Pythons excellent multi-threading. Then communicate via MQTT with Node-RED.

A bit OT:

Your OPC servers, are they running under Linux? (I remember that only Windows was supported initially by OPC due to the dependencies of COM and DCOM and some years ago support for Linux/Unix came along). Are you also developing OPC servers & clients? I used to, using Softing SDK’s

We use Kepware for either a OPC Server or a means to convert OPC-DA to OPC-UA. So the server (Kepware) would resides on this Windows 10 instance with Node-RED. Windows also hosts other support software like Serial to Ethernet Serial port expanders (declining usage, but still required). I will need to revisit these items, or move the “Kepware” to another host in order to convert everything to a Linux environment. I don’t think its feasible at least for now.

Interesting discussion, I am working for core specific thing. I am using Raspberry PI and Node-Red, I am trying to give the node-red for first 2 cores of processor and other 2 cores for I/O device. The problem I am facing is that the data is losing in terms of when I send the data in my server or log. I am using RS 485. Could you possibly help me or suggest me what should I do?

@hp_apcc, @krambriw , in case you're still interested in this topic, we just lunched the new OPC-DA node for Node-RED. It is OS Independent (you can run it on a PI!!! :space_invader::space_invader:)

1 Like