同步操作将从 唯品会/VJTools 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
VJtop serves as a Linux top-like JVM info and busy thread monitoring tool.
We believe readers are familiar with the linux "top" command. And we recommend VJtop to you for monitoring CPU/Memory intensive threads within JVM. Forked from the jvmtop project, VJtop comes with additional features of its own as well as incorporating some nice facilities from the SJK project. Rich information is collected from /proc, PerfData and JMX in a performant way.
VJtop is built as NON stop-the-world and is considered ready for production diagnostics.
Run Maven install task and unzip the resulted zip package in the target folder. Set JAVA_HOME environment variable to your JDK directory.
Run the following command under the same user who started the target process. If access errors are met, try again with root user.
// showing threads consuming the most cpu
./vjtop.sh <PID>
Process data are retrieved
[Note] If the same items appear in both PerfData and JMX, the one from PerfData is perferred. Item in JMX is used instead when PerfData is unavailable.
With ThreadMxBean:
// ranks threads by their cpu time, by default, the top 10 are shown and refreshed in every 10 secs
./vjtop.sh <PID>
// ranks threads by total cpu time since startup, differentiated from cpu time within the interval
./vjtop.sh --totalcpu <PID>
// ranks threads by sys cpu
./vjtop.sh --syscpu <PID>
// ranks threads by total sys cpu
./vjtop.sh --totalsyscpu <PID>
VJTop 1.0.0 - 11:38:02, UPTIME: 3d01h
PID: 127197, JVM: 1.7.0_79, USER: even.liang
PROCESS: 0.99% cpu ( 0.04% of 24 core), 2491m rss, 0m swap
IO: 24k rchar, 1k wchar, 0 read_bytes, 0 write_bytes
THREAD: 97 active, 89 daemon, 99 peak, 461 created, CLASS: 12243 loaded, 0 unloaded
HEAP: 160m/819m eden, 0m/102m sur, 43m/1024m old
NON-HEAP: 55m/256m cms perm gen, 8m/96m codeCache
OFF-HEAP: 0m/0m direct, 0m/0m map
GC: 0/0ms ygc, 0/0ms fgc, SAFE-POINT: 6 count, 1ms time, 1ms syncTime
THREADS-CPU: 1.01% (user= 0.31%, sys= 0.70%)
TID NAME STATE CPU SYSCPU TOTAL TOLSYS
43 metrics-mercury-metric-logger-1-thread-1 TIMED_WAIT 0.38% 0.28% 25.48% 9.13%
110 metrics-mercury-metric-logger-2-thread-1 TIMED_WAIT 0.38% 0.18% 25.43% 9.10%
496 RMI TCP Connection(365)-192.168.200.87 RUNNABLE 0.05% 0.05% 0.00% 0.00%
82 Proxy-Worker-5-10 RUNNABLE 0.01% 0.01% 0.93% 0.30%
120 threadDeathWatcher-6-1 TIMED_WAIT 0.00% 0.00% 0.26% 0.09%
98 Proxy-Worker-5-16 RUNNABLE 0.00% 0.00% 0.80% 0.26%
99 Proxy-Worker-5-17 RUNNABLE 0.00% 0.00% 0.92% 0.31%
63 Proxy-Worker-5-2 RUNNABLE 0.00% 0.00% 1.07% 0.37%
70 Proxy-Worker-5-5 RUNNABLE 0.00% 0.00% 0.78% 0.26%
102 Proxy-Worker-5-20 RUNNABLE 0.00% 0.00% 0.80% 0.27%
Note: Only top 10 threads (according cpu load) are shown!
Cost time: 46ms, CPU time: 60ms
Process Region Explained:
rss
: Resident Set Size
, size of all the pages, fetched from /proc/<pid>/status, for definition see proc filesystem
swap
: Size of pages that are swapped out, fetched from /proc/<pid>/status, for definition see proc filesystem
rchar/wchar
: Number of bytes read/written with system calls, fetched from /proc/<pid>/io, for definition see proc filesystem
read_bytes/write_bytes
: Bytes read from/written to the actual storage layer, fetched from/proc/<pid>/io, for definition see proc filesystem
codeCache
: Cache size holding binaries as result of JIT compilation. JIT Compilation will cease when code cache is fully occupied.direct
: Off-heap memory usage. Note that off-heap usage will not be recorded for recent Netty versions, which bypass the JDK API for memory allocation.SAFE-POINT
: JVM real stop counts and stop time, collected only when PerfData is available.Thread Region Explained:
CPU
: cpu time by percentage within the output interval (100% per core).SYSCPU
: sys cpu time by percentage within the output interval (100% per core).TOTAL
: thread/process total cpu time by percentage since startup.TOLSYS
: total sys cpu time by percentage since startup.Bottom Region Explained :
Cost time
: time cost for data gathering & outputting for this watch.CPU time
: cpu time cost for data gathering & outputting for this watch.// ranks threads by memory allocation rates, by default, the top 10 are shown and refreshed in every 10 secs
./vjtop.sh --memory <PID>
// ranks Threads by total memory allcoation rates since startup (instead of by output interval)
./vjtop.sh --totalmemory <PID>
(headers omitted)
THREADS-MEMORY: 30k/s allocation rate
TID NAME STATE MEMORY TOTAL-ALLOCATED
47636 RMI TCP Connection(583)-127.0.0.1 RUNNABLE 27k/s(88.76%) 17m( 0.00%)
1 main RUNNABLE 2k/s( 8.44%) 370g(83.16%)
47845 JMX server connection timeout 47845 TIMED_WAIT 251/s( 0.80%) 21k( 0.00%)
46607 Worker-501 TIMED_WAIT 60/s( 0.19%) 934m( 0.20%)
46609 Worker-502 TIMED_WAIT 60/s( 0.19%) 822m( 0.18%)
46610 Worker-503 TIMED_WAIT 60/s( 0.19%) 737m( 0.16%)
46763 Worker-504 TIMED_WAIT 60/s( 0.19%) 696m( 0.15%)
46764 Worker-505 TIMED_WAIT 60/s( 0.19%) 743m( 0.16%)
47149 Worker-506 TIMED_WAIT 60/s( 0.19%) 288m( 0.06%)
46551 Worker-500 TIMED_WAIT 60/s( 0.19%) 757m( 0.17%)
Process Region Explained:
allocation rate
: Summed memory allocation speed of all threads.Bottom Region Explained:
STATE
: Current thread stateMEMORY
: Instant memory allocation rate by the second (Instant memory allocation by this thread per second, divided by total allocation)TOTAL-ALLOCATED
: Accumulated memory allocations since startup, including those recycled (Accumulated memory allocation by this thread, divided by total memory allocation)// prints other options
./vjtop.sh -h
// outputs to file
./vjtop.sh <PID> > /tmp/vjtop.log
// refreshes in every 5 secs (default is 10 secs)
./vjtop.sh -d 5 <PID>
// shows the top 20 threads (default is top 10)
./vjtop.sh -l 20 <PID>
// prints by width of 120 characters(default is 100)
./vjtop.sh -w 120 <PID> > /tmp/vjtop.log
// quits after 20 output interations
./vjtop.sh -n 20 <PID>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。