Skip to content

node.js: Don't hardcode heap size to 30000 MB, let it scale with container memory #300

Description

@metalwarrior665

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    performanceIssues related to performance.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions