In Dockerfile, we set ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000. This is needed because normally V8 has a default cap of 4 GB so we wouldn't be able to utilize the heap for larger containers (up to 32 GB). Note that this is a single process heap limit, 4 GB heap limit would still work fine for spawning many browsers with total 32 GB memory.
The problem is that this override cancels the default max_old_space_size setting that depends on the actual system memory. When tested without this override, we saw that Node.js was aware on Actor run container limit, e.g. 256 MB. This would need to be double tested that the old size is really limited.
Making this scale properly helps to avoid out-of-memory in some cases because it forces Node.js to try major garbage collection before it let's the container overflow and crash.
The tricky part is how to make it scale AND also overcome the 4 GB cap.
In Dockerfile, we set
ENV NODE_OPTIONS="--max_old_space_size=30000 --max-http-header-size=80000. This is needed because normally V8 has a default cap of 4 GB so we wouldn't be able to utilize the heap for larger containers (up to 32 GB). Note that this is a single process heap limit, 4 GB heap limit would still work fine for spawning many browsers with total 32 GB memory.The problem is that this override cancels the default
max_old_space_sizesetting that depends on the actual system memory. When tested without this override, we saw that Node.js was aware on Actor run container limit, e.g. 256 MB. This would need to be double tested that the old size is really limited.Making this scale properly helps to avoid out-of-memory in some cases because it forces Node.js to try major garbage collection before it let's the container overflow and crash.
The tricky part is how to make it scale AND also overcome the 4 GB cap.