How do I find out how much RAM an application can handle?

Good afternoon!
Meteor version 1.8.3.

How do I find out how much RAM an application can handle?

The parameter is set.

But there is a crash when about 60 Gb of RAM is reached.

Process.memoryUsage outputs:

{ rss: 203071488,
heapTotal: 157241344,
heapUsed: 119920648,
external: 55724414 }

The value of max-old-space-size
has been gradually increased for several years
From 16 to 32 to 64 and up to 128
as the database grows and new memory blocks are added to the server.

But now it seems as if the process cannot process more than 60Gb of data in memory, although 128Gb is installed on the server.

And errors constantly arise.

<— Last few GCs —>

[7:0x34454c0] 54517700 ms: Mark-sweep 1154.0 (1232.2) → 1153.8 (1234.7) MB, 191.5 / 0.0 ms allocation failure GC in old space requested
[7:0x34454c0] 54517897 ms: Mark-sweep 1153.8 (1234.7) → 1153.8 (1201.2) MB, 197.6 / 0.0 ms last resort GC in old space requested
[7:0x34454c0] 54518089 ms: Mark-sweep 1153.8 (1201.2) → 1153.8 (1201.2) MB, 191.4 / 0.0 ms last resort GC in old space requested

<— JS stacktrace —>

==== JS stack trace =========================================

Security context: 0x20e69cb25891
1: test(this=0xa22e08c5a99 <JSRegExp <String[76]: [\x00-\x1f\ud800-\udfff\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufff0-\uffff]>>,0xdbb6420a471 <Very long string[191833908]>)
2: quote [/app-compiled/bundle/programs/server/npm/node_modules/meteor/ddp-server/node_modules/sockjs/lib/utils.js:~120] [pc=0x1e6b6e9d740b](this=0xa22e0896df9 ,string=0x12d7b75da499 <Very…

Is there any way to check the maximum memory limit for the application that is set from the code?

Do I understand correctly that there are no restrictions and it is possible to load 1TB into RAM?

My first guess would be 128Gb installed does not mean 128Gb free memory.
If you also have mongodb on same server that would explain why 60gb as mongo reserves half of the physical memory.

If you are setting –max-old-space-size with environment variables you can read with process.env.NODE_OPTIONS

**ps: I am kind of curious what you are doing with so much memory. :smiley:


This is what we do to check the memory available to the application, since we had the exact same question about max-old-space-size.

The mapping is just to get a more human-friendly number. The getHeapStatistics() is what you are after.

import v8 from "v8";
import _ from "lodash";

console.log("[process] Started application with heap",
  _.mapValues(v8.getHeapStatistics(), v => `${v / (1024 * 1024)} mb`));

the V8 module in Node also has a bunch of other functions you might want to check out to get at the internals of the memory.

1 Like