@@ -2047,6 +2047,32 @@ On a machine with 2 GiB of memory, consider setting this to
2047
2047
$ node --max-old-space-size=1536 index.js
2048
2048
```
2049
2049
2050
+ ### ` --max-semi-space-size=SIZE ` (in megabytes)
2051
+
2052
+ Sets the maximum [ semi-space] [ ] size for V8's [ scavenge garbage collector] [ ] in
2053
+ MiB (megabytes).
2054
+ Increasing the max size of a semi-space may improve throughput for Node.js at
2055
+ the cost of more memory consumption.
2056
+
2057
+ Since the young generation size of the V8 heap is three times (see
2058
+ [ ` YoungGenerationSizeFromSemiSpaceSize ` ] [ ] in V8) the size of the semi-space,
2059
+ an increase of 1 MiB to semi-space applies to each of the three individual
2060
+ semi-spaces and causes the heap size to increase by 3 MiB. The throughput
2061
+ improvement depends on your workload (see [ #42511 ] [ ] ).
2062
+
2063
+ The default value is 16 MiB for 64-bit systems and 8 MiB for 32-bit systems. To
2064
+ get the best configuration for your application, you should try different
2065
+ max-semi-space-size values when running benchmarks for your application.
2066
+
2067
+ For example, benchmark on a 64-bit systems:
2068
+
2069
+ ``` bash
2070
+ for MiB in 16 32 64 128; do
2071
+ node --max-semi-space-size=$MiB index.js
2072
+ done
2073
+ ```
2074
+
2075
+ [ #42511 ] : https://github.com/nodejs/node/issues/42511
2050
2076
[ Chrome DevTools Protocol ] : https://chromedevtools.github.io/devtools-protocol/
2051
2077
[ CommonJS ] : modules.md
2052
2078
[ ECMAScript module loader ] : esm.md#loaders
@@ -2073,6 +2099,7 @@ $ node --max-old-space-size=1536 index.js
2073
2099
[ `NODE_OPTIONS` ] : #node_optionsoptions
2074
2100
[ `NO_COLOR` ] : https://no-color.org
2075
2101
[ `SlowBuffer` ] : buffer.md#class-slowbuffer
2102
+ [ `YoungGenerationSizeFromSemiSpaceSize` ] : https://chromium.googlesource.com/v8/v8.git/+/refs/tags/10.3.129/src/heap/heap.cc#328
2076
2103
[ `dns.lookup()` ] : dns.md#dnslookuphostname-options-callback
2077
2104
[ `dns.setDefaultResultOrder()` ] : dns.md#dnssetdefaultresultorderorder
2078
2105
[ `dnsPromises.lookup()` ] : dns.md#dnspromiseslookuphostname-options
@@ -2092,6 +2119,8 @@ $ node --max-old-space-size=1536 index.js
2092
2119
[ libuv threadpool documentation ] : https://docs.libuv.org/en/latest/threadpool.html
2093
2120
[ remote code execution ] : https://www.owasp.org/index.php/Code_Injection
2094
2121
[ running tests from the command line ] : test.md#running-tests-from-the-command-line
2122
+ [ scavenge garbage collector ] : https://v8.dev/blog/orinoco-parallel-scavenger
2095
2123
[ security warning ] : #warning-binding-inspector-to-a-public-ipport-combination-is-insecure
2124
+ [ semi-space ] : https://www.memorymanagement.org/glossary/s.html#semi.space
2096
2125
[ timezone IDs ] : https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
2097
2126
[ ways that `TZ` is handled in other environments ] : https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
0 commit comments