[转帖]查看堆内对象的工具:jmap

查看,对象,工具,jmap · 浏览次数 : 0

小编点评

**finalizerinfo 打印等待终结的对象信息** ``` Server compiler detected.JVM version is 25.275-b01 Number of objects pending for finalization: 0 ``` **生成堆存储快照 dump 文件** ``` root@7e2ee19d74ac:/# jmap -dump:format=b,file=heapdump.hprof 1Dumping heap to /heapdump.hprof ...Heap dump file created123 参考:jvm 性能调优工具之 jmap 文章知识点与官方知识档案匹配,可进一步学习相关知识Java技能树首页概览106582 人正在系统学习中 ``` **其他信息** * 进程 ID 1 * 进程名称 "Debugger attached successfully" * 性能调优工具 "jmap"

正文

用途

jmap 可以查看堆内对象的信息,生成 java 程序的 dump 文件,甚至可以查看 ClassLoader 的信息以及 finalizer 队列。

命令格式

jmap [option] <pid> # 连接到正在运行的进程
jmap [option] <executable <core> # 连接到核心文件
jmap [option] [server_id@]<remote server IP or hostname> # 连接到远程调试服务
  • 1
  • 2
  • 3

参数说明:

  1. pid:目标进程的 PID
  2. executable:产生 core dump 的 java 可执行程序
  3. core:被打印信息的 core dump 文件
  4. server-id:可选的唯一 id,如果相同的远程主机上运行了多台调试服务器,用此选项参数标识服务器
  5. remote server IP or hostname:远程调试服务器的 IP 地址或主机名

option 表示选项参数,常见的选项参数如下:

  1. no option:查看进程的内存映像信息
  2. heap:显示堆的详细信息
  3. histo[:live]:显示堆中对象的统计信息
  4. clstats:打印类加载器信息
  5. finalizerinfo:显示在 F-Queue 队列等待 Finalizer 线程执行 finalizer 方法的对象
  6. dump:<dump-options>:生成堆存储快照
  7. F:当 -dump 没有响应时,使用 -dump 或者 -histo 参数,在这个模式下,live 子参数无效
  8. help:帮助信息
  9. J<flag>:指定传递给运行 jmap 的 JVM 的参数

示例

下面我们来看几个使用 jmap 的例子:

注意,由于博主是在 docker 中执行相应的命令,故在新建并启动容器时要加上 --privileged=true --cap-add=SYS_PTRACE 配置,不然在 docker 中无法执行 jmap。

docker run --privileged=true  --cap-add=SYS_PTRACE -d -p 8082:8082 mytest
  • 1

一,no option

查看进程的内存映像信息。该命令打印共享对象映射,即打印目标虚拟机中加载的每个共享对象的起始地址、映射大小以及共享对象文件的路径全称。

root@973ba4cf6586:/# jmap 1
Attaching to process ID 1, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.111-b14
0x0000000000400000      6K      /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
0x00007f99601cb000      75K     /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/libnio.so
0x00007f99609de000      94K     /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/libnet.so
0x00007f9960bf6000      38K     /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/libmanagement.so
0x00007f9975dd3000      34K     /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/libzip.so
0x00007f9975fdc000      46K     /lib/x86_64-linux-gnu/libnss_files-2.19.so
0x00007f99761e8000      42K     /lib/x86_64-linux-gnu/libnss_nis-2.19.so
0x00007f99763f3000      87K     /lib/x86_64-linux-gnu/libnsl-2.19.so
0x00007f997660b000      30K     /lib/x86_64-linux-gnu/libnss_compat-2.19.so
0x00007f9976813000      191K    /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/libjava.so
0x00007f9976a43000      74K     /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/libverify.so
0x00007f9976c56000      31K     /lib/x86_64-linux-gnu/librt-2.19.so
0x00007f9976e5e000      87K     /lib/x86_64-linux-gnu/libgcc_s.so.1
0x00007f9977074000      1026K   /lib/x86_64-linux-gnu/libm-2.19.so
0x00007f9977375000      984K    /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.20
0x00007f9977680000      15805K  /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so
0x00007f9978613000      1697K   /lib/x86_64-linux-gnu/libc-2.19.so
0x00007f99789be000      14K     /lib/x86_64-linux-gnu/libdl-2.19.so
0x00007f9978bc2000      58K     /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/jli/libjli.so
0x00007f9978dd1000      106K    /lib/x86_64-linux-gnu/libz.so.1.2.8
0x00007f9978fec000      134K    /lib/x86_64-linux-gnu/libpthread-2.19.so
0x00007f9979209000      137K    /lib/x86_64-linux-gnu/ld-2.19.so
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27

二,heap

显示堆的详细信息。使用该选项可以打印一个堆的摘要信息,包括使用的 GC 算法、堆配置信息和各区域内存使用信息。

root@7e2ee19d74ac:/# jmap -heap 1
Attaching to process ID 1, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.275-b01

using thread-local object allocation.
Mark Sweep Compact GC

Heap Configuration:
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 482344960 (460.0MB)
NewSize = 10485760 (10.0MB)
MaxNewSize = 160759808 (153.3125MB)
OldSize = 20971520 (20.0MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)

Heap Usage:
New Generation (Eden + 1 Survivor Space):
capacity = 9502720 (9.0625MB)
used = 7132664 (6.802238464355469MB)
free = 2370056 (2.2602615356445312MB)
75.05918305495689% used
Eden Space:
capacity = 8454144 (8.0625MB)
used = 6412176 (6.1151275634765625MB)
free = 2041968 (1.9473724365234375MB)
75.84654342296511% used
From Space:
capacity = 1048576 (1.0MB)
used = 720488 (0.6871109008789062MB)
free = 328088 (0.31288909912109375MB)
68.71109008789062% used
To Space:
capacity = 1048576 (1.0MB)
used = 0 (0.0MB)
free = 1048576 (1.0MB)
0.0% used
tenured generation:
capacity = 20971520 (20.0MB)
used = 13845136 (13.203750610351562MB)
free = 7126384 (6.7962493896484375MB)
66.01875305175781% used

14836 interned Strings occupying 1393776 bytes.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51

三,histo[:live]

显示堆中对象的统计信息,包括了每个 Java 类、对象数量、内存大小(单位:字节)、完全限定的类名。打印的虚拟机内部的类名称将会带有一个 * 前缀。如果指定了 live 子选项,则只计算活动的对象。

root@7e2ee19d74ac:/# jmap -histo:live 1
.
.
.
.
2481:             1             16  sun.reflect.generics.tree.ByteSignature
2482:             1             16  sun.reflect.generics.tree.CharSignature
2483:             1             16  sun.reflect.generics.tree.DoubleSignature
2484:             1             16  sun.reflect.generics.tree.FloatSignature
2485:             1             16  sun.reflect.generics.tree.IntSignature
2486:             1             16  sun.reflect.generics.tree.LongSignature
2487:             1             16  sun.reflect.generics.tree.ShortSignature
2488:             1             16  sun.reflect.generics.tree.VoidDescriptor
2489:             1             16  sun.security.provider.NativePRNG
2490:             1             16  sun.util.calendar.Gregorian
2491:             1             16  sun.util.locale.provider.AuxLocaleProviderAdapter$NullProvider
2492:             1             16  sun.util.locale.provider.CalendarDataUtility$CalendarWeekParameterGetter
2493:             1             16  sun.util.locale.provider.SPILocaleProviderAdapter
2494:             1             16  sun.util.locale.provider.TimeZoneNameUtility$TimeZoneNameGetter
2495:             1             16  sun.util.resources.LocaleData
2496:             1             16  sun.util.resources.LocaleData$LocaleDataResourceBundleControl
Total        235864       12512632
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22

四,clstats

打印类加载器信息。对于每个类加载器而言,它的名称、活跃度、地址、父类加载器、它所加载的类的数量和大小都会被打印。此外,包含的字符串数量和大小也会被打印。

root@7e2ee19d74ac:/# jmap -clstats 1
Attaching to process ID 1, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.275-b01
finding class loader instances ..done.
computing per loader stat ..done.
please wait.. computing liveness..........................................................................liveness analysis may be inaccurate ...
class_loader    classes bytes   parent_loader   alive?  type

<bootstrap> 2026 3553710 null live <internal>
0x00000000ed382638 1 1471 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed78ed78 1 880 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed299328 1 1473 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed03af80 1 1471 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed2999a0 1 1471 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed33deb8 1 1473 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed8bba80 1 1472 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed7d3870 1 1472 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ecdecad0 0 0 null live sun/misc/Launcher\(ExtClassLoader<span class="token annotation punctuation">@0x000000010000fd00</span> <span class="token number">0x00000000ed78ebe8</span> <span class="token number">1</span> <span class="token number">880</span> <span class="token number">0x00000000ecdbd518</span> dead sun<span class="token operator">/</span>reflect<span class="token operator">/</span>DelegatingClassLoader<span class="token annotation punctuation">@0x000000010000a0a0</span> <span class="token number">0x00000000ed2994b8</span> <span class="token number">1</span> <span class="token number">1473</span> <span class="token number">0x00000000ecdbd518</span> dead sun<span class="token operator">/</span>reflect<span class="token operator">/</span>DelegatingClassLoader<span class="token annotation punctuation">@0x000000010000a0a0</span> <span class="token number">0x00000000ed23ecb0</span> <span class="token number">1</span> <span class="token number">1472</span> null dead sun<span class="token operator">/</span>reflect<span class="token operator">/</span>DelegatingClassLoader<span class="token annotation punctuation">@0x000000010000a0a0</span> <span class="token number">0x00000000ed33e2a0</span> <span class="token number">1</span> <span class="token number">1471</span> <span class="token number">0x00000000ecdbd518</span> dead sun<span class="token operator">/</span>reflect<span class="token operator">/</span>DelegatingClassLoader<span class="token annotation punctuation">@0x000000010000a0a0</span> <span class="token number">0x00000000ed3e7e28</span> <span class="token number">1</span> <span class="token number">1472</span> null dead sun<span class="token operator">/</span>reflect<span class="token operator">/</span>DelegatingClassLoader<span class="token annotation punctuation">@0x000000010000a0a0</span> <span class="token number">0x00000000ed298db0</span> <span class="token number">1</span> <span class="token number">880</span> <span class="token number">0x00000000ecdbd518</span> dead sun<span class="token operator">/</span>reflect<span class="token operator">/</span>DelegatingClassLoader<span class="token annotation punctuation">@0x000000010000a0a0</span> <span class="token number">0x00000000ed33dd28</span> <span class="token number">1</span> <span class="token number">1473</span> <span class="token number">0x00000000ecdbd518</span> dead sun<span class="token operator">/</span>reflect<span class="token operator">/</span>DelegatingClassLoader<span class="token annotation punctuation">@0x000000010000a0a0</span> <span class="token number">0x00000000ed5095f0</span> <span class="token number">1</span> <span class="token number">1472</span> <span class="token number">0x00000000ecdbd518</span> dead sun<span class="token operator">/</span>reflect<span class="token operator">/</span>DelegatingClassLoader<span class="token annotation punctuation">@0x000000010000a0a0</span> <span class="token number">0x00000000ed78e8d8</span> <span class="token number">1</span> <span class="token number">1472</span> null dead sun<span class="token operator">/</span>reflect<span class="token operator">/</span>DelegatingClassLoader<span class="token annotation punctuation">@0x000000010000a0a0</span> <span class="token number">0x00000000ed299008</span> <span class="token number">1</span> <span class="token number">1473</span> <span class="token number">0x00000000ecdbd518</span> dead sun<span class="token operator">/</span>reflect<span class="token operator">/</span>DelegatingClassLoader<span class="token annotation punctuation">@0x000000010000a0a0</span> <span class="token number">0x00000000ed33e110</span> <span class="token number">1</span> <span class="token number">1473</span> <span class="token number">0x00000000ecdbd518</span> dead sun<span class="token operator">/</span>reflect<span class="token operator">/</span>DelegatingClassLoader<span class="token annotation punctuation">@0x000000010000a0a0</span> <span class="token number">0x00000000ed43d0e0</span> <span class="token number">1</span> <span class="token number">1471</span> <span class="token number">0x00000000ecdbd518</span> dead sun<span class="token operator">/</span>reflect<span class="token operator">/</span>DelegatingClassLoader<span class="token annotation punctuation">@0x000000010000a0a0</span> <span class="token number">0x00000000ed299580</span> <span class="token number">1</span> <span class="token number">1473</span> <span class="token number">0x00000000ecdbd518</span> dead sun<span class="token operator">/</span>reflect<span class="token operator">/</span>DelegatingClassLoader<span class="token annotation punctuation">@0x000000010000a0a0</span> <span class="token number">0x00000000eced1140</span> <span class="token number">0</span> <span class="token number">0</span> <span class="token number">0x00000000ecdbd8b0</span> live java<span class="token operator">/</span>util<span class="token operator">/</span>ResourceBundle\)RBClassLoader@0x00000001000b64b0
0x00000000ed299198 1 1473 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed691fd8 1 1471 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed33df80 1 1473 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed43d270 1 1472 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed8bafb8 1 1472 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed382700 1 1471 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed78ee40 1 1474 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed299710 1 1473 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed03abb8 1 1472 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed23c518 1 880 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed299a68 1 880 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ecdbd518 3662 5648946 0x00000000ecdbd8b0 live org/springframework/boot/loader/LaunchedURLClassLoader@0x0000000100060a10
0x00000000ed33ddf0 1 1474 null dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed748b30 1 1472 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed7d3938 1 880 null dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed382470 1 1476 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed78ecb0 1 880 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed299260 1 1473 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed0cddc0 1 1472 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed15e2d8 1 1472 null dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed298e78 1 880 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed33dc60 1 880 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed7d3828 1 1472 null dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed78eb20 1 880 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed2993f0 1 1471 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed2211f8 1 1472 null dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed3e7d60 1 1472 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed6f79b0 0 0 0x00000000ecdbd518 live org/springframework/boot/web/embedded/tomcat/TomcatEmbeddedWebappClassLoader@0x00000001003cec70
0x00000000ed299648 1 1471 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed298f40 1 1476 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ecdbd8b0 38 63472 0x00000000ecdecad0 live sun/misc/Launcher$AppClassLoader@0x000000010000f958
0x00000000ed33e1d8 1 1471 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed43d1a8 1 1471 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed4c6ea0 1 1505 null dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed3827c8 1 1471 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed78ef08 1 880 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed2997d8 1 1473 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed03a7f0 1 1471 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed2990d0 1 1471 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed691f10 1 1473 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed33e048 1 1473 0x00000000ecdbd518 dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0
0x00000000ed7d3a00 1 880 null dead sun/reflect/DelegatingClassLoader@0x000000010000a0a0

total = 66 5786 9347389 N/A alive=6, dead=60 N/A

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78

五,finalizerinfo

打印等待终结的对象信息。

root@7e2ee19d74ac:/# jmap -finalizerinfo 1
Attaching to process ID 1, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.275-b01
Number of objects pending for finalization: 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

可见等候回收的对象为0个。

六,dump:<dump-options>

生成堆存储快照 dump 文件,以 hprof 二进制格式存储 Java 堆到指定 filename 的文件中,如果你指定 live 子选项,堆中只有活动的对象会被存储。

执行这个命令,JVM 会将整个 heap 的信息 dump 写入到一个文件,如果 heap 很大的话,这个过程可能非常耗时,而且会在执行的过程中暂停应用。

root@7e2ee19d74ac:/# jmap -dump:format=b,file=heapdump.hprof 1
Dumping heap to /heapdump.hprof ...
Heap dump file created
  • 1
  • 2
  • 3

参考:jvm 性能调优工具之 jmap

文章知识点与官方知识档案匹配,可进一步学习相关知识
Java技能树首页概览106582 人正在系统学习中

与[转帖]查看堆内对象的工具:jmap相似的内容:

[转帖]查看堆内对象的工具:jmap

文章目录 用途命令格式示例一,no option二,heap三,histo[:live]四,clstats五,finalizerinfo六,dump: 用途 jmap 可以查看堆内对象的信息,生成 java 程序的 dump 文件,甚至可以查看 ClassLoader 的

[转帖]JVM NativeMemoryTracking ;jcmd process_id VM.native_memory;Native memory tracking is not enabled

目录 一、Native Memory Tracking (NMT) 是Hotspot VM用来分析VM内部内存使用情况的一个功能。我们可以利用jcmd(jdk自带)这个工具来访问NMT的数据。 1.Native memory tracking is not enabled 打开NMT 二、查看原生内

[转帖]17 种查看 Linux 物理内存的方法

17 种查看 Linux 物理内存的方法 https://linux.cn/article-10235-1.html 大多数系统管理员在遇到性能问题时会检查 CPU 和内存利用率。Linux 中有许多实用程序可以用于检查物理内存。这些命令有助于我们检查系统中存在的物理内存,还允许用户检查各种方面的内

[转帖]Windows设置WiFi走外网,有线网卡走内网。

https://www.itblogcn.com/article/1844.html 文章目录 设置笔记本 WIFI 走外网,网线走内网: 1.查看路由表: 2.删除默认路由: 3.添加 WiFi 路由(走外网): 4.添加网卡路由(走内网): 优先级设置(可选) 设置笔记本 WIFI 走外网,网线

[转帖]如何在 60秒内优化提升 Linux 性能?只有 2% 的人知道,还不快来学习~

https://bbs.huaweicloud.com/blogs/379243 【摘要】 如何在 60秒内优化提升 Linux 性能?只有 2% 的人知道 当你发现 Linux 服务器上的系统性能问题,在最开始的 1 分钟时间里,你会查看哪些系统指标呢? Netflix 在 AWS 上有着大规模的

[转帖]一行Python代码实现同一局域网内的文件共享

在不同的设备之间传输文件除了数据线,网盘传输外是否还有其他优雅的方法?我们可以使用一行Python代码使局域网内的所有设备都可以访问并下载文件夹内的文件。 要求: 电脑中安装配置好python 访问的设备要和电脑处于同一局域网中 步骤 1.查看自己电脑的IP地址 打开一个CMD窗口,输入ipconf

[转帖]jmeter 响应时间rt很小,但是tps也很小&jmeter,脚本处理,千万不要用js

一、背景: 在压测的时候,查看jmeter聚合报告,发现rt很小,但是tps也很小。 讲道理来说,响应时间越小,tps应该越大。 一共压测10分钟,发现jmeter请求的样本数量非常小,才8500个请求。 10分钟内,才打出了8500个请求。 tps= 总样本数量/总时间。 时间是固定的600s,总

[转帖]Docker容器无法访问网络问题(网段冲突)

近日在使用docker在腾讯云服务器上部署项目 运行容器时死活访问不了网络,不论是外网还是内网。 最后找到原因是docker容器ip网段与服务器内网ip网段冲突导致的 使用此命令查看到 ifconfig 1 可以看到ip段冲突了 咱们重建docker的ip段 首先删除docker的网卡docker0

[转帖]36.堆空间的参数设置和-XX:HandlePromotionFailure

目录 1.堆空间参数2.-XX:HandlePromotionFailure 1.堆空间参数 * -XX:+PrintFlagsInitial : 查看所有的参数的默认初始值 * -XX:+PrintFlagsFinal :查看所有的参数的最终值(可能会存在修改,不再是初始值) * 具体查看某个参数

[转帖]fastJson与一起堆内存溢出'血案'

https://www.jianshu.com/p/876d443c2162 现象 QA同学反映登录不上服务器 排查问题1--日志级别 查看log,发现玩家登录的时候抛出了一个java.lang.OutOfMemoryError 大概代码是向Redis序列化一个PlayerMirror镜像数据,但是