首页
随机
最近更改
特殊页面
社群首页
参数设置
关于WHY42
免责声明
WHY42
搜索
用户菜单
登录
欢迎来到Riguz的小站!这是一个私人wiki,用来记录一些我的笔记。
查看“︁JVM optimization”︁的源代码
←
JVM optimization
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
=Linux system tool = == top == <syntaxhighlight lang="bash"> top - 10:55:37 up 1234 days, 20:33, 1 user, load average: 26.61, 31.80, 35.25 Tasks: 485 total, 2 running, 483 sleeping, 0 stopped, 0 zombie %Cpu(s): 82.8 us, 9.4 sy, 0.0 ni, 5.6 id, 0.0 wa, 0.0 hi, 2.2 si, 0.0 st KiB Mem : 26359952+total, 10300115+free, 79046432 used, 81551928 buff/cache KiB Swap: 0 total, 0 free, 0 used. 17903020+avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 35253 work 20 0 27.3g 10.6g 11532 S 817.5 4.2 795248:54 java 38200 work 20 0 27.2g 10.4g 11480 S 774.6 4.1 782100:51 java 33196 work 20 0 27.2g 10.5g 11496 S 663.0 4.2 767660:17 java 38110 work 20 0 27.2g 10.4g 11496 S 368.3 4.2 717635:28 java 38489 work 20 0 27.2g 10.5g 11516 S 286.1 4.2 797625:38 java 198487 work 20 0 134384 18352 888 R 64.0 0.0 0:03.06 netstat 120786 work 20 0 21.7g 4.8g 7032 S 15.5 1.9 410952:23 java 120732 work 20 0 21.7g 4.8g 6996 S 11.2 1.9 346910:48 java 120726 work 20 0 21.7g 4.8g 6980 S 10.2 1.9 355160:19 java 120838 work 20 0 21.7g 4.9g 7244 S 5.6 1.9 407095:04 java 198488 work 20 0 113540 976 820 S 2.3 0.0 0:00.13 awk 197696 root 20 0 0 0 0 S 0.7 0.0 0:00.34 kworker/15:2 10 root 20 0 0 0 0 S 0.3 0.0 10342:55 rcu_sched 161 root 20 0 0 0 0 S 0.3 0.0 947:20.63 ksoftirqd/30 18515 root 20 0 573816 14272 2968 S 0.3 0.0 250:14.40 tuned </syntaxhighlight> == View threads== =查看Java进程= <source lang="bash"> jps top #shift +m按内存排序 </source> [[Image:Jps_Out.png|600px]] [[Image:Top_Out.png|600px]] 有介绍说可以通过PS命令查看进程的线程占用情况,但这里没能提供更多的信息 <source lang="bash"> ps -mp 31560 -o THREAD,tid,time,rss,size,%mem </source> =jmap命令= <source lang="bash"> jmap [option] <pid> <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 -permstat to print permanent generation statistics ... </source> 其中,jmap -histo:live [pid] 可以查看当前Java进程创建的活跃对象数目和占用内存大小。 jmap -dump:live,format=b,file=xxx.xxx [pid] 则可以将当前Java进程的内存占用情况导出来,方便用专门的内存分析工具(例如:MAT)来分析。 <source lang="bash"> jmap -histo:live 31560 | head -n 10 </source> [[Image:Jmap_Head_Out.png|600px]] 其中: #[C is a char[] #[S is a short[] #[I is a int[] #[B is a byte[] #[[I is a int[][] #参考文章 [[http://blog.csdn.net/blade2001/article/details/9066001]] [[Category:JVM]] [[Category:Linux/Unix]]
返回
JVM optimization
。