From 790a82c4b19706a6389ad25a46f29a334f0902b4 Mon Sep 17 00:00:00 2001 From: Ben0it-T Date: Sat, 6 Nov 2021 21:37:18 +0100 Subject: [PATCH 1/3] Add NodeJS statistics - part 1 - heap statistics --- .../components/settings/informationBody.jade | 33 +++++++++++++++++++ i18n/en.i18n.json | 13 +++++++- server/statistics.js | 14 ++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/client/components/settings/informationBody.jade b/client/components/settings/informationBody.jade index 04ea701f4..ef7098e53 100644 --- a/client/components/settings/informationBody.jade +++ b/client/components/settings/informationBody.jade @@ -65,3 +65,36 @@ template(name='statistics') tr th {{_ 'OS_Cpus'}} td {{statistics.os.cpus.length}} + tr + th {{_ 'Node_heap_total_heap_size'}} + td {{bytesToSize statistics.nodeHeapStats.totalHeapSize}} + tr + th {{_ 'Node_heap_total_heap_size_executable'}} + td {{bytesToSize statistics.nodeHeapStats.totalHeapSizeExecutable}} + tr + th {{_ 'Node_heap_total_physical_size'}} + td {{bytesToSize statistics.nodeHeapStats.totalPhysicalSize}} + tr + th {{_ 'Node_heap_total_available_size'}} + td {{bytesToSize statistics.nodeHeapStats.totalAvailableSize}} + tr + th {{_ 'Node_heap_used_heap_size'}} + td {{bytesToSize statistics.nodeHeapStats.usedHeapSize}} + tr + th {{_ 'Node_heap_heap_size_limit'}} + td {{bytesToSize statistics.nodeHeapStats.heapSizeLimit}} + tr + th {{_ 'Node_heap_malloced_memory'}} + td {{bytesToSize statistics.nodeHeapStats.mallocedMemory}} + tr + th {{_ 'Node_heap_peak_malloced_memory'}} + td {{bytesToSize statistics.nodeHeapStats.peakMallocedMemory}} + tr + th {{_ 'Node_heap_does_zap_garbage'}} + td {{statistics.nodeHeapStats.doesZapGarbage}} + tr + th {{_ 'Node_heap_number_of_native_contexts'}} + td {{statistics.nodeHeapStats.numberOfNativeContexts}} + tr + th {{_ 'Node_heap_number_of_detached_contexts'}} + td {{statistics.nodeHeapStats.numberOfDetachedContexts}} diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 4d24733f5..8f1eccef0 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -1098,5 +1098,16 @@ "filter-card-title-label": "Filter by card title", "invite-people-success": "Invitation to register sent with success", "invite-people-error": "Error while sending invitation to register", - "can-invite-if-same-mailDomainName": "Email domain name" + "can-invite-if-same-mailDomainName": "Email domain name", + "Node_heap_total_heap_size": "Node heap : total heap size", + "Node_heap_total_heap_size_executable": "Node heap : total heap size executable", + "Node_heap_total_physical_size": "Node heap : total physical size", + "Node_heap_total_available_size": "Node heap : total available size", + "Node_heap_used_heap_size": "Node heap : used heap size", + "Node_heap_heap_size_limit": "Node heap : heap size limit", + "Node_heap_malloced_memory": "Node heap : malloced memory", + "Node_heap_peak_malloced_memory": "Node heap : peak malloced memory", + "Node_heap_does_zap_garbage": "Node heap : does zap garbage", + "Node_heap_number_of_native_contexts": "Node heap : number of native contexts", + "Node_heap_number_of_detached_contexts": "Node heap : number of detached contexts" } diff --git a/server/statistics.js b/server/statistics.js index 0ead840f4..202c19b66 100644 --- a/server/statistics.js +++ b/server/statistics.js @@ -28,6 +28,20 @@ if (Meteor.isServer) { pid: process.pid, uptime: process.uptime(), }; + const v8 = require('v8'); // Import the v8 module + statistics.nodeHeapStats = { + totalHeapSize: v8.getHeapStatistics().total_heap_size, + totalHeapSizeExecutable: v8.getHeapStatistics().total_heap_size_executable, + totalPhysicalSize: v8.getHeapStatistics().total_physical_size, + totalAvailableSize: v8.getHeapStatistics().total_available_size, + usedHeapSize: v8.getHeapStatistics().used_heap_size, + heapSizeLimit: v8.getHeapStatistics().heap_size_limit, + mallocedMemory: v8.getHeapStatistics().malloced_memory, + peakMallocedMemory: v8.getHeapStatistics().peak_malloced_memory, + doesZapGarbage: v8.getHeapStatistics().does_zap_garbage, + numberOfNativeContexts: v8.getHeapStatistics().number_of_native_contexts, + numberOfDetachedContexts: v8.getHeapStatistics().number_of_detached_contexts, + }; // Remove beginning of Meteor release text METEOR@ let meteorVersion = Meteor.release; meteorVersion = meteorVersion.replace('METEOR@', ''); From d04e9bbabd4ada0df86e9bd3cb377bf6f735785b Mon Sep 17 00:00:00 2001 From: Ben0it-T Date: Sat, 6 Nov 2021 22:49:41 +0100 Subject: [PATCH 2/3] Add NodeJS statistics - part 2 - memory usage --- client/components/settings/informationBody.jade | 12 ++++++++++++ i18n/en.i18n.json | 6 +++++- server/statistics.js | 7 +++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/client/components/settings/informationBody.jade b/client/components/settings/informationBody.jade index ef7098e53..c238d1c28 100644 --- a/client/components/settings/informationBody.jade +++ b/client/components/settings/informationBody.jade @@ -98,3 +98,15 @@ template(name='statistics') tr th {{_ 'Node_heap_number_of_detached_contexts'}} td {{statistics.nodeHeapStats.numberOfDetachedContexts}} + tr + th {{_ 'Node_memory_usage_rss'}} + td {{bytesToSize statistics.nodeMemoryUsage.rss}} + tr + th {{_ 'Node_memory_usage_heap_total'}} + td {{bytesToSize statistics.nodeMemoryUsage.heapTotal}} + tr + th {{_ 'Node_memory_usage_heap_used'}} + td {{bytesToSize statistics.nodeMemoryUsage.heapUsed}} + tr + th {{_ 'Node_memory_usage_external'}} + td {{bytesToSize statistics.nodeMemoryUsage.external}} \ No newline at end of file diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 8f1eccef0..1c985f292 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -1109,5 +1109,9 @@ "Node_heap_peak_malloced_memory": "Node heap : peak malloced memory", "Node_heap_does_zap_garbage": "Node heap : does zap garbage", "Node_heap_number_of_native_contexts": "Node heap : number of native contexts", - "Node_heap_number_of_detached_contexts": "Node heap : number of detached contexts" + "Node_heap_number_of_detached_contexts": "Node heap : number of detached contexts", + "Node_memory_usage_rss": "Node memory usage : Resident Set Size", + "Node_memory_usage_heap_total": "Node memory usage : total size of the allocated heap", + "Node_memory_usage_heap_used": "Node memory usage : actual memory used", + "Node_memory_usage_external": "Node memory usage : external" } diff --git a/server/statistics.js b/server/statistics.js index 202c19b66..999c25cb2 100644 --- a/server/statistics.js +++ b/server/statistics.js @@ -42,6 +42,13 @@ if (Meteor.isServer) { numberOfNativeContexts: v8.getHeapStatistics().number_of_native_contexts, numberOfDetachedContexts: v8.getHeapStatistics().number_of_detached_contexts, }; + let memoryUsage = process.memoryUsage(); + statistics.nodeMemoryUsage = { + rss: memoryUsage.rss, + heapTotal: memoryUsage.heapTotal, + heapUsed: memoryUsage.heapUsed, + external: memoryUsage.external, + }; // Remove beginning of Meteor release text METEOR@ let meteorVersion = Meteor.release; meteorVersion = meteorVersion.replace('METEOR@', ''); From d8dad479fd854c0b471ccd5613cb433d62cbd843 Mon Sep 17 00:00:00 2001 From: Lauri Ojansivu Date: Sun, 7 Nov 2021 00:47:53 +0200 Subject: [PATCH 3/3] Fixes typos. --- i18n/en.i18n.json | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 1c985f292..4418c0f29 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -1099,19 +1099,19 @@ "invite-people-success": "Invitation to register sent with success", "invite-people-error": "Error while sending invitation to register", "can-invite-if-same-mailDomainName": "Email domain name", - "Node_heap_total_heap_size": "Node heap : total heap size", - "Node_heap_total_heap_size_executable": "Node heap : total heap size executable", - "Node_heap_total_physical_size": "Node heap : total physical size", - "Node_heap_total_available_size": "Node heap : total available size", - "Node_heap_used_heap_size": "Node heap : used heap size", - "Node_heap_heap_size_limit": "Node heap : heap size limit", - "Node_heap_malloced_memory": "Node heap : malloced memory", - "Node_heap_peak_malloced_memory": "Node heap : peak malloced memory", - "Node_heap_does_zap_garbage": "Node heap : does zap garbage", - "Node_heap_number_of_native_contexts": "Node heap : number of native contexts", - "Node_heap_number_of_detached_contexts": "Node heap : number of detached contexts", - "Node_memory_usage_rss": "Node memory usage : Resident Set Size", - "Node_memory_usage_heap_total": "Node memory usage : total size of the allocated heap", - "Node_memory_usage_heap_used": "Node memory usage : actual memory used", - "Node_memory_usage_external": "Node memory usage : external" + "Node_heap_total_heap_size": "Node heap: total heap size", + "Node_heap_total_heap_size_executable": "Node heap: total heap size executable", + "Node_heap_total_physical_size": "Node heap: total physical size", + "Node_heap_total_available_size": "Node heap: total available size", + "Node_heap_used_heap_size": "Node heap: used heap size", + "Node_heap_heap_size_limit": "Node heap: heap size limit", + "Node_heap_malloced_memory": "Node heap: malloced memory", + "Node_heap_peak_malloced_memory": "Node heap: peak malloced memory", + "Node_heap_does_zap_garbage": "Node heap: does zap garbage", + "Node_heap_number_of_native_contexts": "Node heap: number of native contexts", + "Node_heap_number_of_detached_contexts": "Node heap: number of detached contexts", + "Node_memory_usage_rss": "Node memory usage: resident set size", + "Node_memory_usage_heap_total": "Node memory usage: total size of the allocated heap", + "Node_memory_usage_heap_used": "Node memory usage: actual memory used", + "Node_memory_usage_external": "Node memory usage: external" }