localhost:Downloads wuxuan.chai$ java -jar arthas-boot.jar [INFO] arthas-boot version: 3.3.3 [INFO] Process 84742 already using port 3658 [INFO] Process 84742 already using port 8563 [INFO] Found existing java process, please choose one and input the serial number of the process, eg : 1. Then hit ENTER. * [1]: 84742 com.yiyi.Application [2]: 84898 arthas-boot.jar [3]: 1572 kafka.Kafka [4]: 981 org.apache.zookeeper.server.quorum.QuorumPeerMain [5]: 84726 org.codehaus.plexus.classworlds.launcher.Launcher [6]: 83691 [7]: 84010 org.jetbrains.idea.maven.server.RemoteMavenServer36
[arthas@84742]$ dashboard ID NAME GROUP PRIORITY STATE %CPU TIME INTERRUPTED DAEMON 149 Timer-for-arthas-dashboard-3bf90e35- system 10 RUNNABLE 51 0:0 false true 113 Catalina-utility-1 main 1 TIMED_WAITI 14 0:0 false false 116 http-nio-7070-BlockPoller main 5 RUNNABLE 14 0:0 false true 127 http-nio-7070-ClientPoller main 5 RUNNABLE 13 0:0 false true 114 Catalina-utility-2 main 1 WAITING 5 0:0 false false 131 Attach Listener system 9 RUNNABLE 0 0:0 false true 130 DestroyJavaVM main 5 RUNNABLE 0 0:1 false false 3 Finalizer system 8 WAITING 0 0:0 false true 2 Reference Handler system 10 WAITING 0 0:0 false true 4 Signal Dispatcher system 9 RUNNABLE 0 0:0 false true 136 arthas-shell-server system 9 TIMED_WAITI 0 0:0 false true 137 arthas-shell-server system 9 TIMED_WAITI 0 0:0 false true 133 arthas-timer system 9 WAITING 0 0:0 false true 141 as-command-execute-daemon system 10 TIMED_WAITI 0 0:0 false true 115 container-0 main 5 TIMED_WAITI 0 0:0 false false Memory used total max usage GC heap 169M 370M 3641M 4.66% gc.ps_scavenge.count 4 ps_eden_space 140M 183M 1344M 10.46% gc.ps_scavenge.time(ms) 37 ps_survivor_space 0K 10752K 10752K 0.00% gc.ps_marksweep.count 2 ps_old_gen 29M 176M 2731M 1.07% gc.ps_marksweep.time(ms) 118 nonheap 53M 57M -1 92.98% code_cache 5M 7M 240M 2.17% metaspace 42M 44M -1 95.78% Runtime os.name Mac OS X os.version 10.14.6 java.version 1.8.0_241 java.home /Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/jre systemload.average 3.25 processors 8 uptime
上半部分是程序的线程信息,中间是内存使用情况,这里可以查看gc的次数,下面是当前程序运行的环境信息
1.4.2、thread命令查看进程
1 2 3 4 5 6 7
[arthas@84742]$ thread 115 "container-0" Id=115 TIMED_WAITING at java.lang.Thread.sleep(Native Method) at org.apache.catalina.core.StandardServer.await(StandardServer.java:570) at org.springframework.boot.web.embedded.tomcat.TomcatWebServer$1.run(TomcatWebServer.java:197)
[arthas@89977]$ stack com.yiyi.api.WeixinSupportApi getAccessToken Press Q or Ctrl+C to abort. Affect(class count: 1 , method count: 1) cost in 43 ms, listenerId: 8 ts=2020-07-06 17:50:49;thread_name=http-nio-7070-exec-2;id=83;is_daemon=true;priority=5;TCCL=org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedWebappClassLoader@2fc07784 @com.yiyi.api.WeixinSupportApi.getAccessToken() at com.yiyi.api.WeixinSupportApi.sendMessage(WeixinSupportApi.java:68) at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909) at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748)