溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

有哪些常用性能分析命令與工具

發(fā)布時間:2021-10-23 17:20:24 來源:億速云 閱讀:445 作者:iii 欄目:編程語言

本篇內(nèi)容介紹了“有哪些常用性能分析命令與工具”的有關(guān)知識,在實際案例的操作過程中,不少人都會遇到這樣的困境,接下來就讓小編帶領(lǐng)大家學(xué)習(xí)一下如何處理這些情況吧!希望大家仔細閱讀,能夠?qū)W有所成!

常用命令

  1. jstack

    1. 查看:/usr/bin/jstack -l 11400

    2. 導(dǎo)出:/usr/bin/jstack 11400 > thread.txt

    3. 統(tǒng)計:/usr/bin/jstack -l 11400 | grep 'Apollo-RemoteConfigRepository-1' | wc -l

    4. 查看cpu占用高進程:

    5. 輸出:1

    6. 輸出:
      "SimplePauseDetectorThread_0" #78 daemon prio=9 os_prio=0 tid=0x00007f664c07c800 nid=0x2efd sleeping[0x00007f662aa37000]
      java.lang.Thread.State: TIMED_WAITING (sleeping)
      at java.lang.Thread.sleep(Native Method)
      at java.lang.Thread.sleep(Thread.java:340)
      at java.util.concurrent.TimeUnit.sleep(TimeUnit.java:386)
      at org.LatencyUtils.TimeServices.sleepNanos(TimeServices.java:62)
      at org.LatencyUtils.SimplePauseDetector$SimplePauseDetectorThread.run(SimplePauseDetector.java:116)

      "Thread-32" #77 daemon prio=9 os_prio=0 tid=0x00007f664c074800 nid=0x2efc waiting on condition [0x00007f662aa78000]
      java.lang.Thread.State: WAITING (parking)
      at sun.misc.Unsafe.park(Native Method)
      - parking to wait for <0x00000000ed80df78> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
      at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
      at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
      at org.LatencyUtils.PauseDetector$PauseDetectorThread.run(PauseDetector.java:85)

      "RxIoScheduler-1 (Evictor)" #76 daemon prio=5 os_prio=0 tid=0x00007f66a8735800 nid=0x2eed waiting on condition [0x00007f662acb9000]
      java.lang.Thread.State: TIMED_WAITING (parking)
      at sun.misc.Unsafe.park(Native Method)
      - parking to wait for <0x00000000ed51a578> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
      at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)
      at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)
      at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)
      at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)
      at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)

      "Connection evictor" #75 daemon prio=5 os_prio=0 tid=0x00007f66a8659000 nid=0x2eec waiting on condition [0x00007f662acfa000]

    7. 2efd

    8. 輸出:PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
      12029 root 20 0 4396512 813692 8668 S 6.2 10.2 0:05.74 java
      12527 root 20 0 4396512 813692 8668 S 6.2 10.2 0:41.19 java

    9. top -H -p 11400

    10. printf '%x\n' 12029

    11. jstack 11400 | grep 2efd -A 30

    12. jstack

      Usage:
          jstack [-l] <pid>
              (to connect to running process)
          jstack -F [-m] [-l] <pid>
              (to connect to a hung process)
          jstack [-m] [-l] <executable> <core>
              (to connect to a core file)
          jstack [-m] [-l] [server_id@]<remote server IP or hostname>
              (to connect to a remote debug server)
      
      Options:
          -F  to force a thread dump. Use when jstack <pid> does not respond (process is hung)
          -m  to print both java and native frames (mixed mode)
          -l  long listing. Prints additional information about locks
          -h or -help to print this help message

      值得關(guān)注的線程狀態(tài)有:

    13. 死鎖,Deadlock(重點關(guān)注) 

    14. 執(zhí)行中,Runnable   

    15. 等待資源,Waiting on condition(重點關(guān)注) 

    16. 等待獲取監(jiān)視器,Waiting on monitor entry(重點關(guān)注)

    17. 暫停,Suspended

    18. 對象等待中,Object.wait() 或 TIMED_WAITING

    19. 阻塞,Blocked(重點關(guān)注)  

    20. 停止,Parked

    21. jstack能得到運行java程序的java stack和native stack的信息。可以輕松得知當前線程的運行情況。

    22. 用途

    23. 命令參數(shù)

    24. 用法

  2. jmap

    1. 查看進程的內(nèi)存映像信息:jmap 11400

    2. 顯示Java堆詳細信息:jmap -heap 11400

    3. 顯示堆中對象的統(tǒng)計信息:/usr/bin/jmap -histo:live 11400 | head -20

    4. 生成堆轉(zhuǎn)儲快照dump文件: jmap -dump:live,format=b,file=/tmp/heap.hprof 11400

    5. 輸出:Attaching to process ID 11400, please wait...
      Debugger attached successfully.
      Server compiler detected.
      JVM version is 25.121-b13
      0x0000000000400000 7K /usr/java/jdk1.8.0_121/jre/bin/java
      0x00007f664832e000 250K /usr/java/jdk1.8.0_121/jre/lib/amd64/libsunec.so
      0x00007f6684bfe000 66K /usr/lib64/libbz2.so.1.0.6
      0x00007f6684e0e000 153K /usr/lib64/liblzma.so.5.2.2
      0x00007f6685034000 88K /usr/lib64/libz.so.1.2.7
      0x00007f668524a000 97K /usr/lib64/libelf-0.166.so
      0x00007f6685462000 19K /usr/lib64/libattr.so.1.1.0
      0x00007f6685667000 86K /usr/lib64/libgcc_s-4.8.5-20150702.so.1
      0x00007f668587d000 294K /usr/lib64/libdw-0.166.so
      0x00007f6685ac5000 19K /usr/lib64/libcap.so.2.22
      0x00007f6685cca000 107K /usr/lib64/libresolv-2.17.so
      0x00007f6685ee4000 30K /usr/lib64/libnss_dns-2.17.so
      0x00007f66862eb000 90K /usr/java/jdk1.8.0_121/jre/lib/amd64/libnio.so
      0x00007f6687be0000 113K /usr/java/jdk1.8.0_121/jre/lib/amd64/libnet.so
      0x00007f6687df7000 49K /usr/java/jdk1.8.0_121/jre/lib/amd64/libmanagement.so
      0x00007f66c8000000 64K /usr/lib64/libnss_myhostname.so.2
      0x00007f66c9bc1000 121K /usr/java/jdk1.8.0_121/jre/lib/amd64/libzip.so
      0x00007f66c9ddc000 60K /usr/lib64/libnss_files-2.17.so
      0x00007f66c9fef000 48K /usr/java/jdk1.8.0_121/jre/lib/amd64/libinstrument.so
      0x00007f66ca1f9000 220K /usr/java/jdk1.8.0_121/jre/lib/amd64/libjava.so
      0x00007f66ca425000 64K /usr/java/jdk1.8.0_121/jre/lib/amd64/libverify.so
      0x00007f66ca633000 42K /usr/lib64/librt-2.17.so
      0x00007f66ca83b000 1110K /usr/lib64/libm-2.17.so
      0x00007f66cab3d000 16591K /usr/java/jdk1.8.0_121/jre/lib/amd64/server/libjvm.so
      0x00007f66cbb2f000 2105K /usr/lib64/libc-2.17.so
      0x00007f66cbefd000 18K /usr/lib64/libdl-2.17.so
      0x00007f66cc101000 99K /usr/java/jdk1.8.0_121/jre/lib/amd64/jli/libjli.so
      0x00007f66cc317000 138K /usr/lib64/libpthread-2.17.so
      0x00007f66cc533000 159K /usr/lib64/ld-2.17.so

    6. 輸出:Attaching to process ID 11400, please wait...
      Debugger attached successfully.
      Server compiler detected.
      JVM version is 25.121-b13

      using parallel threads in the new generation.
      using thread-local object allocation.
      Concurrent Mark-Sweep GC

      Heap Configuration:
      MinHeapFreeRatio = 40
      MaxHeapFreeRatio = 70
      MaxHeapSize = 536870912 (512.0MB)
      NewSize = 134217728 (128.0MB)
      MaxNewSize = 134217728 (128.0MB)
      OldSize = 402653184 (384.0MB)
      NewRatio = 2
      SurvivorRatio = 8
      MetaspaceSize = 21807104 (20.796875MB)
      CompressedClassSpaceSize = 1073741824 (1024.0MB)
      MaxMetaspaceSize = 268435456 (256.0MB)
      G1HeapRegionSize = 0 (0.0MB)

      Heap Usage:
      New Generation (Eden + 1 Survivor Space):
      capacity = 120848384 (115.25MB)
      used = 66229472 (63.161346435546875MB)
      free = 54618912 (52.088653564453125MB)
      54.80377131066974% used
      Eden Space:
      capacity = 107479040 (102.5MB)
      used = 63536296 (60.592933654785156MB)
      free = 43942744 (41.907066345214844MB)
      59.11505722418064% used
      From Space:
      capacity = 13369344 (12.75MB)
      used = 2693176 (2.5684127807617188MB)
      free = 10676168 (10.181587219238281MB)
      20.144413966758577% used
      To Space:
      capacity = 13369344 (12.75MB)
      used = 0 (0.0MB)
      free = 13369344 (12.75MB)
      0.0% used
      concurrent mark-sweep generation:
      capacity = 402653184 (384.0MB)
      used = 176729160 (168.54206085205078MB)
      free = 225924024 (215.45793914794922MB)
      43.89116168022156% used

    7. 輸出:

      num #instances #bytes class name
      ----------------------------------------------
      1: 273268 29359760 [C
      2: 337511 10800352 java.util.concurrent.ConcurrentHashMap$Node
      3: 217704 10449792 org.aspectj.weaver.reflect.ShadowMatchImpl
      4: 116214 10226832 java.lang.reflect.Method
      5: 217712 6966784 org.aspectj.weaver.patterns.ExposedState
      6: 69225 6647552 [Ljava.lang.Object;
      7: 271133 6507192 java.lang.String
      8: 12598 6112856 [B
      9: 1479 3026296 [Ljava.util.concurrent.ConcurrentHashMap$Node;
      10: 50114 2806384 java.util.LinkedHashMap
      11: 24799 2751976 java.lang.Class
      12: 66869 2674760 java.util.LinkedHashMap$Entry
      13: 34280 2507280 [Ljava.util.HashMap$Node;
      14: 11273 2043680 [I
      15: 78910 1932576 [Z
      16: 60015 1920480 java.util.HashMap$Node
      17: 78497 1883920 [Lorg.aspectj.weaver.ast.Var;

    8. 輸出:Dumping heap to /tmp/heap.hprof ...
      Heap dump file created

    9. jmap

      Usage:              

           jmap [option] <pid>              

               (to connect to running process)              

           jmap [option] <executable <core>              

               (to connect to a core file)              

           jmap [option] [server_id@]<remote server IP or hostname>              

               (to connect to remote debug server)              

       

      where <option> is one of:              

           <none>               to print same info as Solaris pmap              

           -heap                to print java heap summary              

           -histo[:live]        to print histogram of java object heap;  if   the  "live"              

                                suboption is specified, only count live objects              

           -clstats             to print  class   loader statistics              

           -finalizerinfo       to print information on objects awaiting finalization              

           -dump:<dump-options> to dump java heap in hprof binary format              

                                dump-options:              

                                  live         dump only live objects;  if   not specified,              

                                               all objects in the heap are dumped.              

                                  format=b     binary format              

                                  file=<file>  dump heap to <file>              

                                Example: jmap -dump:live,format=b,file=heap.bin <pid>              

           -F                   force. Use with -dump:<dump-options> <pid> or -histo              

                                to force a heap dump or histogram when <pid> does not              

                                respond. The  "live"   suboption is not supported              

                                in  this   mode.              

           -h | -help           to print  this   help message              

           -J<flag>             to pass <flag> directly to the runtime system              

    10. 得到運行java程序的內(nèi)存分配的詳細情況,可以生成 java 程序的 dump 文件, 也可以查看堆內(nèi)對象示例的統(tǒng)計信息、查看 ClassLoader 的信息以及 finalizer 隊列。

    11. 用途

    12. 命令參數(shù)

    13. 用法

  3. jstat

    1. 查看垃圾回收:jstat -gcutil 11400 1000 5

    2. O:老年代使用比例

    3. M:元數(shù)據(jù)區(qū)使用比例

    4. CCS:壓縮使用比例

    5. YGC:年輕代垃圾回收次數(shù)

    6. FGCT:老年代垃圾回收消耗時間(單位:s秒)

    7. GCT:垃圾回收消耗總時間(單位:s秒)

    8. 輸出:
      S0 S1 E O M CCS YGC YGCT FGC FGCT GCT
      0.00 16.15 33.06 35.11 94.91 92.76 507 11.471 10 2.549 14.019
      0.00 16.15 34.19 35.11 94.91 92.76 507 11.471 10 2.549 14.019
      0.00 16.15 34.30 35.11 94.91 92.76 507 11.471 10 2.549 14.019
      0.00 16.15 34.51 35.11 94.91 92.76 507 11.471 10 2.549 14.019
      0.00 16.15 35.63 35.11 94.91 92.76 507 11.471 10 2.549 14.019

    9. jstat

      Usage: jstat -help|-options              

              jstat -<option> [-t] [-h<lines>] <vmid> [<interval> [<count>]]              

       

      Definitions:              

         <option>      An option reported by the -options option              

         <vmid>        Virtual Machine Identifier. A vmid takes the following form:              

                            <lvmid>[@<hostname>[:<port>]]              

                       Where <lvmid> is the local vm identifier  for   the target              

                       Java virtual machine, typically a process id; <hostname> is              

                       the name of the host running the target Java virtual machine;              

                       and <port> is the port number  for   the rmiregistry on the              

                       target host. See the jvmstat documentation  for   a more complete              

                       description of the Virtual Machine Identifier.              

         <lines>       Number of samples between header lines.              

         <interval>    Sampling interval. The following forms are allowed:              

                           <n>[ "ms" | "s" ]              

                       Where <n> is an integer and the suffix specifies the units as              

                       milliseconds( "ms" ) or seconds( "s" ). The  default   units are  "ms" .              

         <count>       Number of samples to take before terminating.              

         -J<flag>      Pass <flag> directly to the runtime system.              

    10. 監(jiān)視虛擬機各種運行狀態(tài)信息的命令行工具,查看堆內(nèi)存各部分的使用量,以及加載類的數(shù)量

    11. 用途

    12. 命令參數(shù)

    13. 用法

  4. netstat

    1. 顯示網(wǎng)卡列表:netstat -i

    2. 顯示網(wǎng)絡(luò)統(tǒng)計:netstat -lntup

    3. 統(tǒng)計機器中網(wǎng)絡(luò)連接各個狀態(tài)個數(shù):netstat -anc | grep 9092

    4. 找出程序運行的端口:netstat -ap | grep 11400

    5. 輸出:
      Kernel Interface table
      Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
      eth0 1500 127092481 0 2325462 0 90637447 0 0 0 BMRU
      lo 65536 275564 0 0 0 275564 0 0 0 LRU

    6. 輸出:
      Active Internet connections (only servers)
      Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
      tcp 0 0 0.0.0.0:9039 0.0.0.0:* LISTEN 11400/java
      tcp 0 0 0.0.0.0:9999 0.0.0.0:* LISTEN 11400/java
      tcp 0 0 0.0.0.0:9071 0.0.0.0:* LISTEN 15250/java
      tcp 0 0 0.0.0.0:9072 0.0.0.0:* LISTEN 4078/java
      tcp 0 0 0.0.0.0:9073 0.0.0.0:* LISTEN 4586/java
      tcp 0 0 0.0.0.0:50001 0.0.0.0:* LISTEN 4586/java
      tcp 0 0 0.0.0.0:9078 0.0.0.0:* LISTEN 13131/java
      tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 815/sshd
      tcp 0 0 0.0.0.0:8087 0.0.0.0:* LISTEN 28760/java
      tcp 0 0 0.0.0.0:10072 0.0.0.0:* LISTEN 4078/java
      tcp 0 0 0.0.0.0:7071 0.0.0.0:* LISTEN 1453/java
      tcp 0 0 0.0.0.0:7072 0.0.0.0:* LISTEN 32059/java
      tcp 0 0 0.0.0.0:9088 0.0.0.0:* LISTEN 24501/java
      tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 795/zabbix_agentd
      tcp 0 0 0.0.0.0:16869 0.0.0.0:* LISTEN 1453/java
      tcp6 0 0 :::22 :::* LISTEN 815/sshd
      tcp6 0 0 :::10050 :::* LISTEN 795/zabbix_agentd
      udp 0 0 127.0.0.1:323 0.0.0.0:* 499/chronyd
      udp6 0 0 ::1:323 :::* 499/chronyd

    7. 輸出:
      tcp 0 0 172.16.20.142:40464 172.16.20.60:9092 ESTABLISHED
      tcp 0 0 172.16.20.142:52536 172.16.20.60:9092 ESTABLISHED
      tcp 0 0 172.16.20.142:58202 172.16.20.60:9092 ESTABLISHED
      tcp 0 0 172.16.20.142:41314 172.16.20.60:9092 ESTABLISHED
      tcp 0 0 172.16.20.142:40826 172.16.20.60:9092 ESTABLISHED
      tcp 0 0 172.16.20.142:41150 172.16.20.60:9092 ESTABLISHED
      tcp 0 0 172.16.20.142:54978 172.16.20.60:9092 ESTABLISHED

    8. 輸出:
      tcp 0 0 0.0.0.0:9039 0.0.0.0:* LISTEN 11400/java
      tcp 0 0 0.0.0.0:distinct 0.0.0.0:* LISTEN 11400/java
      tcp 0 0 ext-spring-md-sho:55364 work-arch-lb-1:6379 ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:54114 db-work-01:ms-sql-s ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:45768 172.16.20.1:amqp ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:49960 172.16.20.1:ms-sql-s ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:49932 172.16.20.1:ms-sql-s ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:49954 172.16.20.1:ms-sql-s ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:47498 172.16.20.38:eforward ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:49946 172.16.20.1:ms-sql-s ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:49970 172.16.20.1:ms-sql-s ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:54616 st-arch-polari:webcache ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:49964 172.16.20.1:ms-sql-s ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:49968 172.16.20.1:ms-sql-s ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:54144 db-work-01:ms-sql-s ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:54112 db-work-01:ms-sql-s ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:54096 db-work-01:ms-sql-s ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:40826 172.16.20.:XmlIpcRegSvc ESTABLISHED 11400/java
      tcp 1 0 ext-spring-md-sho:41072 172.16.20.168:mysql CLOSE_WAIT 11400/java
      tcp 0 0 ext-spring-md-sho:49956 172.16.20.1:ms-sql-s ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:49966 172.16.20.1:ms-sql-s ESTABLISHED 11400/java
      tcp 0 0 ext-spring-md-sho:54098 db-work-01:ms-sql-s ESTABLISHED 11400/java  

    9. netstat

      usage: netstat [-vWeenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help}              

              netstat [-vWnNcaeol] [<Socket> ...]              

              netstat { [-vWeenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s [-6tuw] } [delay]              

       

               -r, --route              display routing table              

               -I, --interfaces=<Iface> display  interface   table  for   <Iface>              

               -i, --interfaces         display  interface   table              

               -g, --groups             display multicast group memberships              

               -s, --statistics         display networking statistics (like SNMP)              

               -M, --masquerade         display masqueraded connections              

       

               -v, --verbose            be verbose              

               -W, --wide               don't truncate IP addresses              

               -n, --numeric            don't resolve names              

               --numeric-hosts          don't resolve host names              

               --numeric-ports          don't resolve port names              

               --numeric-users          don't resolve user names              

               -N, --symbolic           resolve hardware names              

               -e, --extend             display other/more information              

               -p, --programs           display PID/Program name  for   sockets              

               -o, --timers             display timers              

               -c, --continuous         continuous listing              

       

               -l, --listening          display listening server sockets              

               -a, --all                display all sockets ( default : connected)              

               -F, --fib                display Forwarding Information Base ( default )              

               -C, --cache              display routing cache instead of FIB              

               -Z, --context            display SELinux security context  for   sockets              

       

         <Socket>={-t|--tcp} {-u|--udp} {-U|--udplite} {-S|--sctp} {-w|--raw}              

                  {-x|--unix} --ax25 --ipx --netrom              

         <AF>=Use  '-6|-4'   or  '-A <af>'   or  '--<af>' default : inet              

         List of possible address families (which support routing):              

           inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX. 25 )              

           netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP)              

           x25 (CCITT X. 25 )              

    10. 用于顯示與IP、TCP、UDP和ICMP協(xié)議相關(guān)的統(tǒng)計數(shù)據(jù),一般用于檢驗本機各端口的網(wǎng)絡(luò)連接情況

    11. 用途

    12. 命令參數(shù)

    13. 用法

常用工具

  1. jconsole

    1. 有哪些常用性能分析命令與工具

    2. 有哪些常用性能分析命令與工具

    3. 應(yīng)用啟動參數(shù):-Djava.rmi.server.hostname=xxxxx -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=12345

    4. 點擊JDK/bin 目錄下面的jconsole.exe 即可啟動

    5. 有哪些常用性能分析命令與工具

    6. 啟動使用

    7. 查看內(nèi)存

    8. 查看線程

  2. MAT

    1. 通過圖型列出最大的Object

    2. 有哪些常用性能分析命令與工具

    3. 列出線程的樹結(jié)構(gòu),及線程下面對象占用內(nèi)存的空間

    4. 有哪些常用性能分析命令與工具

    5. 自動分析內(nèi)存內(nèi)存泄漏的原因,可以直接定位到Class,且行數(shù)

    6. 有哪些常用性能分析命令與工具

    7. 有哪些常用性能分析命令與工具

    8. 有哪些常用性能分析命令與工具

    9. 有哪些常用性能分析命令與工具

    10. Class Name : 類名稱,java類名

    11. Objects : 類的對象的數(shù)量,這個對象被創(chuàng)建了多少個

    12. Shallow Heap :一個對象內(nèi)存的消耗大小,不包含對其他對象的引用

    13. Retained Heap :是shallow Heap的總和,也就是該對象被GC之后所能回收到內(nèi)存的總和

    14. 有哪些常用性能分析命令與工具

    15. 打開dump文件

    16. Histogram

    17. 在某一項上右鍵打開菜單選擇 list objects ->with incoming refs 將列出該類的實例

    18. 快速找出某個實例沒被釋放的原因,可以右健 Path to GC Roots–>exclue all phantom/weak/soft etc. reference :

    19. Leak Suspects

    20. Dominator Tree

    21. Top Comsumers

jprofile

  1. 啟動使用

    1. 在被分析的jvm 的啟動參數(shù)增加下面內(nèi)容:-agentpath:/opt/jprofiler11/bin/linux-x64/libjprofilerti.so=port=8849

    2. 點擊jprofiler.exe
      執(zhí)行菜單Session–Integr ation Wizards–New Server Integration
      選擇JDK
      選擇Web容器是否和Jprofiler一起運行
      有哪些常用性能分析命令與工具

    3.     輸入服務(wù)器地址,在服務(wù)器上執(zhí)行jpenable

    4.      /usr/local/bin/jpenable

    5.      Select a JVM:
            ext-service-md-car-check-analysis.jar [10125] [1]

    6.       Please select the profiling mode:
            GUI mode (attach with JProfiler GUI) [1, Enter]
            Offline mode (use config file to set profiling settings) [2]
            Please enter a profiling port
            [45763]
            8849
            You can now use the JProfiler GUI to connect on port 8849
        有哪些常用性能分析命令與工具

    7.     選擇安裝目錄

    8.   有哪些常用性能分析命令與工具

    9.     端口號指定

    10.   有哪些常用性能分析命令與工具

  2. 使用分析

    1. 有哪些常用性能分析命令與工具

    2. 有哪些常用性能分析命令與工具

    3. 有哪些常用性能分析命令與工具

    4. 接入

    5. overview:

    6. cpu views:可錄像回放

show-busy-java-threads

  1. 使用文檔

    1. https://github.com/oldratlee/useful-scripts/blob/master/docs/java.md#-show-busy-java-threads

arthas

  1. 使用文檔

    1. https://arthas.aliyun.com/doc/

jvisualvm

  1. 使用文檔

    1. https://docs.oracle.com/javase/8/docs/technotes/guides/visualvm/index.html

JFR(飛行器)

  1. 使用方法

    1. 創(chuàng)建一個包含了你自己配置的JFR模板文件。運行jmc, 然后Window->Flight Recording Template Manage菜單。準備好檔案后,就可以導(dǎo)出文件,并移動到要排查問題的環(huán)境中。

    2. 有哪些常用性能分析命令與工具

    3. 一分鐘后可查看記錄數(shù)據(jù),通過這些數(shù)據(jù),可以清楚的了解到這一分鐘時間內(nèi),整個

    4. 有哪些常用性能分析命令與工具

    5. 有哪些常用性能分析命令與工具

“有哪些常用性能分析命令與工具”的內(nèi)容就介紹到這里了,感謝大家的閱讀。如果想了解更多行業(yè)相關(guān)的知識可以關(guān)注億速云網(wǎng)站,小編將為大家輸出更多高質(zhì)量的實用文章!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI