Whether Node-red supports clipping to reduce Node-red running memory?

#1

Hi guys,

Currently, the running memory of node-red is too large(About 70M RAM). Due to the memory limit of the embedded device, can the node-red function be clipped to reduce the running memory of node-red?

thanks very much!

#2

Well.. it is not 'too large' for me. And what is 'the embedded device' ?

#3

Do you mean the memory usage while running ? You can trim the amount used by node.js before garbage collection kicks in. We usually have a node-red-pi command insalled byt default that allows you to start Node-RED and pass this in easily for example

node-red-pi --max-old-space-size=256

sets it to 256MB

#4

The Device is Router gateway, the device use 128M RAM.
Before node-red running, the memory free is 81M
image
After node-red running, the memory free is 5M
image

The node-red running use almost 76M RAM. i want to know there are anyway to reduce the node-red runnning memory,such as find some way to "clipping the node-red"?

#5

The node-red application use almost 76M RAM in the Router gateway, i need reduce the running memory for node-red.Because my device free memory is only 81M RAM or less. i want to know that whether we can clip the node-red function or other way to reduce the running memory.

#6

so as I said maybe

node-red-pi --max-old-space-size=64

or 48 or ...
but these are not hard limits - this is when garbage collection kicks in - so if you have large buffers arriving (like images etc) then you can easily blow past that... but I don't know what your app is doing so can't guess how much data you are trying to handle.

2 Likes
#9

I have tested in my device by using option --max-old-space-size=20, after running node-red , the free memory can increase to 25M, (before is 5M). But the node-red Performance becomes poor. So can i remove the node-red Built-in nodes(such as not useful)to reduce the running memory?

#10

any other way to reduce the node-red running memory, besides It doesn't degrade performance.

#11

you can remove unused nodes if you want to. Removing any core ones may be hard as you would have to rebuild the project without them as they are built into a single minified zip.

#12

or you could use an orange pi zero for 10$...

1 Like
#13

The latest betas allow Node-red to run without the admin interface. @dceejay would that be a way to save memory?

#14

No, the latest betas have split up the internal packaging of the runtime and editor. We do not provide a separate executable that is just the runtime - but you could write your own app that embeds the node-red runtime and just runs that. It's a subtle but important distinction - we are not setting out to provide separate runtime and editor executables in the 0.20 release.

But I think the gains would be very marginal. You can already disable the editor through the disableEditor property.

You can disable core nodes using the nodeExcludes setting - it isn't one we have documented, but we use it in our default IBM Cloud setup to remove the UDP/TCP nodes amongst others - https://github.com/ibmets/node-red-bluemix-starter/blob/master/bluemix-settings.js#L47 - the setting lists the filenames of node that should be ignored. You'd have to pick out the filenames for the nodes you didn't want. But again, the saving would be fairly marginal.

1 Like
#15

@dceejay @knolleary Thanks for the reply.

Now I have an idea for you to evaluate whether the idea is feasible.

I use a device(Debugging device)with enough memory to complete the programming flow and deployment process.

But only the function of node-red running the flows is required on the actual field device(lots of equipment with memory limit), and other function (such as editing flow, deployment flow and WEB server functions ...)are removed or not running.

Only the Node-red running flows function or environment is preserved and other functions all removed.

Is this feasible?

#16

@knolleary @dceejay
Hi , could you give me some advice? Thanks.