Java 性能优化笔记

1、cat /proc/meminfo
20:16 [[email protected]]$ cat /proc/meminfo 
MemTotal:     32915692 kB
MemFree:       3503512 kB
Buffers:        710656 kB
Cached:       23038124 kB
SwapCached:          0 kB
Active:       15198332 kB
Inactive:     13184936 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:     32915692 kB
LowFree:       3503512 kB
SwapTotal:     4194460 kB
SwapFree:      4194160 kB
Dirty:             768 kB
Writeback:           0 kB
AnonPages:     4633532 kB
Mapped:          23772 kB
Slab:           968768 kB
PageTables:      15004 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:  20652304 kB
Committed_AS: 11278388 kB
VmallocTotal: 34359738367 kB
VmallocUsed:    265952 kB
VmallocChunk: 34359471923 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
Hugepagesize:     2048 kB


2、vmstat
20:16 [[email protected]]$ vmstat
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 1  0    300 3508340 710652 23032412    0    0     0     2    0    0  0  0 100  0  0


3、top
tty:[3] jobs:[0] cwd:[~]
20:18 [[email protected]]$ top
top - 20:20:56 up 392 days,  2:26,  5 users,  load average: 0.58, 0.87, 0.84
Tasks: 311 total,   1 running, 310 sleeping,   0 stopped,   0 zombie
Cpu(s):  2.3%us,  0.2%sy,  0.0%ni, 97.3%id,  0.1%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:  32915692k total, 29417280k used,  3498412k free,   710664k buffers
Swap:  4194460k total,      300k used,  4194160k free, 23043968k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                                                               
20123 cafe      18   0 5315m 3.3g  10m S 59.5 10.4   4790:57 java                                                                                  
12947 nginx     15   0  268m  27m  936 S  2.3  0.1 106:34.36 nginx                                                                                 
    2 root      RT  -5     0    0    0 S  0.3  0.0  15:02.25 migration/0                                                                           
13221 mongod    15   0  503m  16m 4884 S  0.3  0.1  45:13.38 mongod                                                                                
    1 root      15   0 10368  680  572 S  0.0  0.0   0:05.19 init                                                                                  
    3 root      34  19     0    0    0 S  0.0  0.0   0:00.80 ksoftirqd/0                                                                           
    4 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/0                                                                            
    5 root      RT  -5     0    0    0 S  0.0  0.0   0:17.88 migration/1                                                                           
    6 root      34  19     0    0    0 S  0.0  0.0   0:00.01 ksoftirqd/1                                                                           
    7 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/1   


4、mpstat
10:56 [[email protected]]$ mpstat
Linux 2.6.18-308.el5 (a01.crond.uc.zhaowei.youku)       2014年07月01日

10时59分26秒  CPU   %user   %nice    %sys %iowait    %irq   %soft  %steal   %idle    intr/s
10时59分26秒  all    1.44    0.00    0.03    0.07    0.00    0.01    0.00   98.44    368.89


5、netstat -i
20:22 [[email protected]]$ netstat -i
Kernel Interface table
Iface       MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
eth0       1500   0 30169625431      0   1190      0 14671156375      0      0      0 BMRU
lo        16436   0 47968271      0      0      0 47968271      0      0      0 LRU
tty:[2] jobs:[0] cwd:[~]


6、iostat
20:25 [[email protected]]$ iostat
Linux 2.6.18-308.el5 (a01.crond.uc.zhaowei.youku)       2014年07月01日

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           1.44    0.00    0.05    0.07    0.00   98.44

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               2.84         5.94       153.74  176752409 4570969202
sda1              0.00         0.00         0.00       2052         98
sda2              1.06         0.29        21.44    8484306  637521448
sda3              0.00         0.00         0.00       1430        600
sda4              0.00         0.00         0.00          8          0
sda5              1.77         5.66       132.30  168264077 3933447056

tty:[2] jobs:[0] cwd:[~]


 iostat -xm 5
Linux 2.6.18-308.el5 (a01.crond.uc.zhaowei.youku)       2014年07月01日

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           1.44    0.00    0.05    0.07    0.00   98.44

Device:         rrqm/s   wrqm/s   r/s   w/s    rMB/s    wMB/s avgrq-sz avgqu-sz   await  svctm  %util
sda               0.01    16.43  0.05  2.79     0.00     0.08    56.31     0.11   37.73   7.07   2.00
sda1              0.00     0.00  0.00  0.00     0.00     0.00    14.53     0.00   10.42   7.95   0.00
sda2              0.00     1.63  0.02  1.05     0.00     0.01    20.42     0.03   31.82   7.10   0.76
sda3              0.00     0.00  0.00  0.00     0.00     0.00    58.00     0.00   13.17  10.00   0.00
sda4              0.00     0.00  0.00  0.00     0.00     0.00     2.00     0.00    2.75   2.75   0.00
sda5              0.01    14.80  0.03  1.74     0.00     0.06    77.86     0.07   41.28   8.04   1.42

你可能感兴趣的:(Java 性能优化)