node.js - How do I get the instance memory in use for a Node-Express App running in CloudFoundry? -


i building app node-express backend , deploying cloudfoundry. know can total instance memory vcap_application var , able os memory using 'os' module. seems can application memory using 'util' module, none of parameters of returned object process.memoryusage() seem i'm looking for. doing following that:

// modules i've tried var express = require('express'),     app = express(),     os = require("os"),     util = require("util");  // memory statistics can -> cannot instance memory in use var memlimit = json.parse(process.env.vcap_application)['limits']['mem'];     totalmem = os.totalmem(),     freemem = os.freemem(),     memused = util.inspect(process.memoryusage()).split(" "),     heapused = memused[6],     heaptotal = memused[4].substr(0,memused[4].length-1);     rss = memused[2].substr(0,memused[2].length-1); 

does know how can use heap/rss values or other modules looking for?

i can think of 2 ways of potentially accomplishing this.

if don't need value within app, cf utility can tell how memory process using.

running cf app <app-name> provide stats given app, 1 of memory usage.

in case need app code, try node-memwatch package. can periodically emit events stats memory usage.

you take @ code node-memwatch uses see how compute values.

be careful, though. memory profiling can expensive, watch , how it's implemented.


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -