@@ -2034,6 +2034,32 @@ On a machine with 2 GiB of memory, consider setting this to
2034
2034
$ node --max-old-space-size=1536 index.js
2035
2035
```
2036
2036
2037
+ ### ` --max-semi-space-size=SIZE ` (in megabytes)
2038
+
2039
+ Sets the maximum [ semi-space] [ ] size for V8's [ scavenge garbage collector] [ ] in
2040
+ MiB (megabytes).
2041
+ Increasing the max size of a semi-space may improve throughput for Node.js at
2042
+ the cost of more memory consumption.
2043
+
2044
+ Since the young generation size of the V8 heap is three times (see
2045
+ [ ` YoungGenerationSizeFromSemiSpaceSize ` ] [ ] in V8) the size of the semi-space,
2046
+ an increase of 1 MiB to semi-space applies to each of the three individual
2047
+ semi-spaces and causes the heap size to increase by 3 MiB. The throughput
2048
+ improvement depends on your workload (see [ #42511 ] [ ] ).
2049
+
2050
+ The default value is 16 MiB for 64-bit systems and 8 MiB for 32-bit systems. To
2051
+ get the best configuration for your application, you should try different
2052
+ max-semi-space-size values when running benchmarks for your application.
2053
+
2054
+ For example, benchmark on a 64-bit systems:
2055
+
2056
+ ``` bash
2057
+ for MiB in 16 32 64 128; do
2058
+ node --max-semi-space-size=$MiB index.js
2059
+ done
2060
+ ```
2061
+
2062
+ [ #42511 ] : https://github.com/nodejs/node/issues/42511
2037
2063
[ Chrome DevTools Protocol ] : https://chromedevtools.github.io/devtools-protocol/
2038
2064
[ CommonJS ] : modules.md
2039
2065
[ ECMAScript module loader ] : esm.md#loaders
@@ -2059,6 +2085,7 @@ $ node --max-old-space-size=1536 index.js
2059
2085
[ `NODE_OPTIONS` ] : #node_optionsoptions
2060
2086
[ `NO_COLOR` ] : https://no-color.org
2061
2087
[ `SlowBuffer` ] : buffer.md#class-slowbuffer
2088
+ [ `YoungGenerationSizeFromSemiSpaceSize` ] : https://chromium.googlesource.com/v8/v8.git/+/refs/tags/10.3.129/src/heap/heap.cc#328
2062
2089
[ `dns.lookup()` ] : dns.md#dnslookuphostname-options-callback
2063
2090
[ `dns.setDefaultResultOrder()` ] : dns.md#dnssetdefaultresultorderorder
2064
2091
[ `dnsPromises.lookup()` ] : dns.md#dnspromiseslookuphostname-options
@@ -2078,6 +2105,8 @@ $ node --max-old-space-size=1536 index.js
2078
2105
[ libuv threadpool documentation ] : https://docs.libuv.org/en/latest/threadpool.html
2079
2106
[ remote code execution ] : https://www.owasp.org/index.php/Code_Injection
2080
2107
[ running tests from the command line ] : test.md#running-tests-from-the-command-line
2108
+ [ scavenge garbage collector ] : https://v8.dev/blog/orinoco-parallel-scavenger
2081
2109
[ security warning ] : #warning-binding-inspector-to-a-public-ipport-combination-is-insecure
2110
+ [ semi-space ] : https://www.memorymanagement.org/glossary/s.html#semi.space
2082
2111
[ timezone IDs ] : https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
2083
2112
[ ways that `TZ` is handled in other environments ] : https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
0 commit comments