-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc: Add useful V8 option section #32262
Conversation
This adds new section for v8 options and --max-old-space-size Fixes: nodejs#32252
Fixed a typo addition in doc/cli.md Fixes: nodejs#32252
doc/api/cli.md
Outdated
|
||
These are v8 options and fall outside Node.js' responsibility. | ||
|
||
V8 options that are allowed are: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should either be removed completely or at least reworded. Node does not restrict the V8 options that can be passed on the command line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is another place in the document mentioning the same thing.
doc/api/cli.md
Outdated
Sets the max memory size of V8 old memory section. As memory consumption approaches the limit, V8 will spend more time on garbage collection in an effort to free unused memory. | ||
|
||
On a machine with 2GB of memory it suggested to set 1.5GB to leave some memory for other uses and avoid swapping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sets the max memory size of V8 old memory section. As memory consumption approaches the limit, V8 will spend more time on garbage collection in an effort to free unused memory. | |
On a machine with 2GB of memory it suggested to set 1.5GB to leave some memory for other uses and avoid swapping. | |
Sets the max memory size of V8 old memory section. As memory | |
consumption approaches the limit, V8 will spend more time on | |
garbage collection in an effort to free unused memory. | |
On a machine with 2GB of memory it suggested to set 1.5GB to | |
leave some memory for other uses and avoid swapping. |
nit: need to wrap lines at <= 80 chars
doc/api/cli.md
Outdated
@@ -1385,6 +1385,20 @@ threadpool by setting the `'UV_THREADPOOL_SIZE'` environment variable to a value | |||
greater than `4` (its current default value). For more information, see the | |||
[libuv threadpool documentation][]. | |||
|
|||
## Useful v8 options | |||
|
|||
These are v8 options and fall outside Node.js' responsibility. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are v8 options and fall outside Node.js' responsibility. | |
V8 has CLI options. Any V8 CLI option that is provided to `node` will be passed on to V8 to handle. V8's options have _no stability guarantee_. The V8 team themselves don't consider them to be part of their formal API, and reserve the right to change them at any time. The Node.js team does not consider them covered by the Node.js stability guarantees. Many of the V8 options are of interest only to V8 developers. Despite this, there is a small set of V8 options that are widely applicable to Node.js, and they are documented here. |
I think we should say something like the above.
doc/api/cli.md
Outdated
|
||
V8 options that are allowed are: | ||
|
||
### `--max-old-space-size` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
### `--max-old-space-size` | |
### `--max-old-space-size=SIZE` (in Mbytes) |
Co-Authored-By: mscdex <mscdex@users.noreply.github.com>
Co-Authored-By: mscdex <mscdex@users.noreply.github.com>
according to me, explaning the gc behavior is not necessary while describing the heap size flag. also, elaborate description about API stability can confuse people? how about just this: |
Detailed about V8 because people can get confused about the behaviour of GC, we are explicitly mentioning that it is managed by V8 here. Also, it doesn't lie in node preview. |
Signed-off-by: Nimit <nimitagg95@gmail.com>
doc/api/cli.md
Outdated
and reserve the right to change them at any time. The Node.js team does not | ||
consider them covered by the Node.js stability guarantees. Many of the V8 | ||
options are of interest only to V8 developers. Despite this, there is a small | ||
set of V8 options that are widely applicable to the Node.js, and they are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set of V8 options that are widely applicable to the Node.js, and they are | |
set of V8 options that are widely applicable to Node.js, and they are |
doc/api/cli.md
Outdated
consider them covered by the Node.js stability guarantees. Many of the V8 | ||
options are of interest only to V8 developers. Despite this, there is a small | ||
set of V8 options that are widely applicable to the Node.js, and they are | ||
documented here. V8 options that are allowed are: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
documented here. V8 options that are allowed are: | |
documented here: |
doc/api/cli.md
Outdated
consumption approaches the limit, V8 will spend more time on | ||
garbage collection in an effort to free unused memory. | ||
|
||
On a machine with 2GB of memory it suggested to set 1.5GB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a machine with 2GB of memory it suggested to set 1.5GB | |
On a machine with 2GB of memory it is suggested to set this to 1536 (1.5GB) |
doc/api/cli.md
Outdated
|
||
### `--max-old-space-size=SIZE` (in Mbytes) | ||
|
||
Sets the max memory size of V8 old memory section. As memory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sets the max memory size of V8 old memory section. As memory | |
Sets the max memory size of V8's old memory section. As memory |
Signed-off-by: Nimit <nimitagg95@gmail.com>
Just a note: when squashing/landing, make sure 'V8' is used instead of 'v8' in the commit message to avoid confusion. |
Anything to be done here from me? |
doc/api/cli.md
Outdated
and reserve the right to change them at any time. The Node.js team does not | ||
consider them covered by the Node.js stability guarantees. Many of the V8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional nit:
and reserve the right to change them at any time. The Node.js team does not | |
consider them covered by the Node.js stability guarantees. Many of the V8 | |
and reserve the right to change them at any time. Likewise, they are not | |
covered by the Node.js stability guarantees. Many of the V8 |
doc/api/cli.md
Outdated
consumption approaches the limit, V8 will spend more time on | ||
garbage collection in an effort to free unused memory. | ||
|
||
On a machine with 2GB of memory it is suggested to set this to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing comma:
On a machine with 2GB of memory it is suggested to set this to | |
On a machine with 2GB of memory, it is suggested to set this to |
Optional nit: I'm not a fan of "it is suggested" or "it is recommended" formulations. If possible, either tell people to do something or don't tell them at all. If you can't make a blanket statement, it might at least be a little more direct with something like "consider":
On a machine with 2GB of memory it is suggested to set this to | |
On a machine with 2GB of memory, consider setting this to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood.
doc/api/cli.md
Outdated
On a machine with 2GB of memory it is suggested to set this to | ||
1536 (1.5GB) to leave some memory for other uses and avoid swapping. | ||
|
||
E.g. `node --max-old-space-size=1536 index.js` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional nit: Delete this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally feel an example helps a lot when being introduced to a flag. It clearly shows how to pass an argument. @Trott
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I personally feel an example helps a lot when being introduced to a flag
If we want to provide an example, it should conform with the formatting of the other examples provided elsewhere in the doc. Otherwise, each entry is inventing its own example formatting, and we definitely do not want that. The existing format is more useful than this as it provides context, such as what the anticipated output might look like. So, this example might show the error one might get if running without the flag, then show the command succeeding with the flag.
(That said, most of our entries do not contain examples and that seems appropriate in this document.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally agree with your point, Can you point me to some of the correct existing formats?
What I see a mixture of formats, some given below
- node --name-of-flag index.mjs
- node --name-of-flag
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't mean the format of the command itself. I mean the markdown formatting that denotes an example.
```console
$ node --cpu-prof index.js
$ ls *.cpuprofile
CPU.20190409.202950.15293.0.0.cpuprofile
```
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Trott can you check out the formatting once now.
@Trott do you want to apply your suggestions and merge this? |
Hey, will make the changes today. Totally forgot about this :) |
Signed-off-by: Nimit <nimitagg95@gmail.com>
My one remaining comment is a nit. In other words, it expresses my personal opinion, but I don't feel so strongly about it that I would block landing this if others disagree with my view. So if @addaleax or anyone else thinks this should land now as it is, go for it. |
Signed-off-by: Nimit <nimitagg95@gmail.com>
landed in df05b07 |
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes