Projects tigase _server server-core Issues #1330
Add Native Memory Tracking to JMX statistics (#1330)
wojciech.kapcia@tigase.net opened 2 years ago

Currently only available via jcmd from shell but it gives a lot of usefull informrmations:

cmd 1 VM.native_memory summary
1:

Native Memory Tracking:

(Omitting categories weighting less than 1KB)

Total: reserved=1530885KB, committed=1079713KB
-                 Java Heap (reserved=819200KB, committed=819200KB)
                            (mmap: reserved=819200KB, committed=819200KB)

-                     Class (reserved=215479KB, committed=10679KB)
                            (classes #13404)
                            (  instance classes #12588, array classes #816)
                            (malloc=2487KB #50156)
                            (mmap: reserved=212992KB, committed=8192KB)
                            (  Metadata:   )
                            (    reserved=65536KB, committed=58624KB)
                            (    used=58053KB)
                            (    waste=571KB =0.97%)
                            (  Class space:)
                            (    reserved=212992KB, committed=8192KB)
                            (    used=7337KB)
                            (    waste=855KB =10.44%)

-                    Thread (reserved=59433KB, committed=9281KB)
                            (thread #94)
                            (stack: reserved=59172KB, committed=9020KB)
                            (malloc=153KB #562)
                            (arena=108KB #185)

-                      Code (reserved=252117KB, committed=62997KB)
                            (malloc=4429KB #18870)
                            (mmap: reserved=247688KB, committed=58568KB)

-                        GC (reserved=79110KB, committed=79110KB)
                            (malloc=15834KB #27193)
                            (mmap: reserved=63276KB, committed=63276KB)

-                  Compiler (reserved=986KB, committed=986KB)
                            (malloc=822KB #1325)
                            (arena=165KB #5)

-                  Internal (reserved=895KB, committed=895KB)
                            (malloc=891KB #25578)
                            (mmap: reserved=4KB, committed=4KB)

-                     Other (reserved=2395KB, committed=2395KB)
                            (malloc=2395KB #59)

-                    Symbol (reserved=11408KB, committed=11408KB)
                            (malloc=9898KB #282713)
                            (arena=1511KB #1)

-    Native Memory Tracking (reserved=7043KB, committed=7043KB)
                            (malloc=21KB #315)
                            (tracking overhead=7022KB)

-        Shared class space (reserved=12288KB, committed=12100KB)
                            (mmap: reserved=12288KB, committed=12100KB)

-               Arena Chunk (reserved=178KB, committed=178KB)
                            (malloc=178KB)

-                   Tracing (reserved=32KB, committed=32KB)
                            (arena=32KB #1)

-                   Logging (reserved=8KB, committed=8KB)
                            (malloc=8KB #294)

-                 Arguments (reserved=2KB, committed=2KB)
                            (malloc=2KB #87)

-                    Module (reserved=1698KB, committed=1698KB)
                            (malloc=1698KB #6218)

-                 Safepoint (reserved=8KB, committed=8KB)
                            (mmap: reserved=8KB, committed=8KB)

-           Synchronization (reserved=216KB, committed=216KB)
                            (malloc=216KB #2247)

-            Serviceability (reserved=1KB, committed=1KB)
                            (malloc=1KB #18)

-                 Metaspace (reserved=66258KB, committed=59346KB)
                            (malloc=722KB #879)
                            (mmap: reserved=65536KB, committed=58624KB)

-      String Deduplication (reserved=2097KB, committed=2097KB)
                            (malloc=2097KB #32625)

-                   Unknown (reserved=32KB, committed=32KB)
                            (mmap: reserved=32KB, committed=32KB)

Access via:

ManagementFactory.getPlatformMBeanServer().invoke(
    new ObjectName("com.sun.management:type=DiagnosticCommand"),
    "vmNativeMemory,
    new Object[]{"summary"},
    new String[]{"[Ljava.lang.String;"});

And parse properly.

(Should probably be available natively in the future: https://bugs.openjdk.java.net/browse/JDK-8182634 but for the time being)

wojciech.kapcia@tigase.net commented 2 years ago

Actually it was already implemented in #systems-83, added scale for better readability and documentation.

issue 1 of 1
Type
Task
Priority
Normal
Assignee
Version
tigase-server-8.3.0
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#1330
Please wait...
Page is in error, reload to recover