Skip to content
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

Interesting tests, though I cannot replicate use of swap #1

Open
tommedema opened this issue Mar 2, 2017 · 2 comments
Open

Interesting tests, though I cannot replicate use of swap #1

tommedema opened this issue Mar 2, 2017 · 2 comments

Comments

@tommedema
Copy link

tommedema commented Mar 2, 2017

I am doing an experimental test where I am running a big data regression in memory on a machine with relatively low RAM (32gb) but with a huge swap SSD (300gb).

Of course this is perhaps not a good idea; but I would like to give it a try and see actual benchmarks.

The problem is that node doesn't seem to be able to use swap, even though swapon -s confirms that 300gb of swap is available. I've run node as per your recommendation:

node --expose-gc --max_semi_space_size=4480 --max_old_space_size=286720 --max_executable_size=143360 src/main.js

The system has enough physical and virtual RAM:
screen shot 2017-03-01 at 19 40 51

I created a simple memtest.js script to see if node will start using swap:

const targetBytes = 500 * 1024 * 1024 * 1024; // 500gb
const arrLength = Math.pow(2, 32) - 1;
const arrLength2 = 20000;

let arr = new Array(arrLength);
for (var i = 0, il = arrLength; i < il; i++) {
  let arr2 = new Array(arrLength2);
  for (var i2 = 0, il2 = arrLength2; i2 < il2; i2++) {
    arr2[i2] = Math.random();
  }
  arr[i] = arr2;
  if (i % 100 === 0) {
    console.log(process.memoryUsage().heapUsed / 1024 / 1024);
  }
}

The result is:

screen shot 2017-03-01 at 19 42 57

Initially it seems to go well. But then at this point it will hit the physical RAM amount and for some reason throw an out of memory exception:

screen shot 2017-03-01 at 20 27 51

screen shot 2017-03-01 at 19 40 40

Your tests specifically test for virtual memory. Do you have any clue as to why it still throws an OOM at the physical memory limit? Why doesn't it start to use more swap?

@tommedema
Copy link
Author

Same for Google Compute Engine (Debian). It exits at about 28GB. This machine had 6GB physical RAM and 250GB virtual RAM.

screen shot 2017-03-05 at 19 31 52

Is there something in node that causes this to happen at about 30GB RAM usage, no matter the amount of SWAP remaining?

@tommedema
Copy link
Author

Note that on the same machine the same test but run with PHP works just fine (using 70GB+ without issues).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant