diff options
| author | Daniil Fedotov <daniil@rabbitmq.com> | 2017-06-14 12:05:26 +0100 |
|---|---|---|
| committer | Gerhard Lazu <gerhard@rabbitmq.com> | 2017-06-14 12:05:26 +0100 |
| commit | b6efa2dd3c0adea4212d28e43524fab7bc2a91af (patch) | |
| tree | 122cfbf4cb45437cb146ca97e6f853766e0f45f8 | |
| parent | 6a84ef415d5b493f5ee4008883e5cd34cdc923af (diff) | |
| download | rabbitmq-server-git-b6efa2dd3c0adea4212d28e43524fab7bc2a91af.tar.gz | |
Use OS memory total when reporting memory usage
Account for extra memory that was reported in other_ets
[#145451399]
Signed-off-by: Gerhard Lazu <gerhard@rabbitmq.com>
| -rw-r--r-- | src/rabbit_vm.erl | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/rabbit_vm.erl b/src/rabbit_vm.erl index f22396e2e3..648ad9d8a3 100644 --- a/src/rabbit_vm.erl +++ b/src/rabbit_vm.erl @@ -30,7 +30,6 @@ %%---------------------------------------------------------------------------- -%% Like erlang:memory(), but with awareness of rabbit-y things memory() -> All = interesting_sups(), {Sums, _Other} = sum_processes( @@ -41,7 +40,7 @@ memory() -> [aggregate(Names, Sums, memory, fun (X) -> X end) || Names <- distinguished_interesting_sups()], - Mnesia = mnesia_memory(), + MnesiaETS = mnesia_memory(), MsgIndexETS = ets_memory([msg_store_persistent, msg_store_transient]), MetricsETS = ets_memory([rabbit_metrics]), MetricsProc = try @@ -52,8 +51,10 @@ memory() -> 0 end, MgmtDbETS = ets_memory([rabbit_mgmt_storage]), + {OsTotal, _} = vm_memory_monitor:get_memory_use(bytes), - [{total, Total}, + + [{total, ErlangTotal}, {processes, Processes}, {ets, ETS}, {atom, Atom}, @@ -66,24 +67,40 @@ memory() -> - ConnsReader - ConnsWriter - ConnsChannel - ConnsOther - Qs - QsSlave - MsgIndexProc - Plugins - MgmtDbProc - MetricsProc, - [{total, Total}, + [ + %% Connections {connection_readers, ConnsReader}, {connection_writers, ConnsWriter}, {connection_channels, ConnsChannel}, {connection_other, ConnsOther}, + + %% Queues {queue_procs, Qs}, {queue_slave_procs, QsSlave}, + + %% Processes {plugins, Plugins}, {other_proc, lists:max([0, OtherProc])}, %% [1] - {mnesia, Mnesia}, + + %% Metrics {metrics, MetricsETS + MetricsProc}, {mgmt_db, MgmtDbETS + MgmtDbProc}, - {msg_index, MsgIndexETS + MsgIndexProc}, - {other_ets, ETS - Mnesia - MsgIndexETS - MgmtDbETS}, + + %% ETS + {mnesia, MnesiaETS}, + {other_ets, ETS - MnesiaETS - MetricsETS - MgmtDbETS - MsgIndexETS}, + + %% Messages (mostly, some binaries are not messages) {binary, Bin}, + {msg_index, MsgIndexETS + MsgIndexProc}, + + %% System {code, Code}, {atom, Atom}, - {other_system, System - ETS - Atom - Bin - Code}]. + {other_system, System - ETS - Bin - Code - Atom + (OsTotal - ErlangTotal)}, + + {total, OsTotal} + ]. %% [1] - erlang:memory(processes) can be less than the sum of its %% parts. Rather than display something nonsensical, just silence any |
