Node.JS - any side effects of oversized oversize?

Our server runs Node.JS on the PaaS cloud (in particular, Bluemix). We can adjust the amount of allocated memory through the PaaS control panel, but I noticed that for values ​​above ~ 1.4 GB you also need to execute node with the option --max-old-space-size (explanation here ).

This means that whenever I want to change the size of the allocated memory, I have to change it in two places in the settings.

What happens if I call node --max-old-space-size 99999999999 app.js ? Will Node.JS try to allocate 99999999999MB, or will it consider the actual VM \ Container memory limit in which it is running? Does this affect the behavior of the GC (i.e. if it looks like there is a lot of free space, the GC will work less time)? Is there a --max-old-space-size use-machine-limits option?

thanks

+5
source share
2 answers

What happens if I call node-max-old-space-size 99999999999 app.js? Will Node.JS try to allocate 99999999999MB, or will it look at the actual VM \ Container memory limit in which it works?

Node will not allocate the specified memory, but it will try in response to the growing need for memory, if this happens, in the application - in stages - in fairly small fragments.

Does this affect the behavior of the GC (i.e. if it looks like there is a lot of free space, the GC will work less time)?

Yes, the ownership space can contain a lot of garbage, and allocation will be less frequent.

Is there a -max-old-space-size-use-machine-limits option?

Honestly, I don’t know, but I will investigate this and update it here if I get information about it.

Hope this helps.

+4
source

giving a large heap size will make gc slow and keep the old values. However, providing a large heap size will cause frequent gc operations and there may be a risk of getting an Out-of-Memory exception

0
source

Source: https://habr.com/ru/post/1246636/


All Articles