Record your favorite Linux system commands for easy reference later, and find that memory is getting worse.
Find the most CPU-intensive java thread
ps command
command:
ps -mp pid -o THREAD, tid, time or ps -Lfp pid
the results show:
this command behaves mainly be Get some information about the thread corresponding to a process. For example, if you want to analyze some of the running bottlenecks of a Java process, you can use this command to find the CPU usage time of all current Threads, which is the last column here.
For example, here found a TID: 30834, which takes up the highest TIME time.
First convert to hexadecimal by printf "%x\ " 30834, continue to dump the stack information of the current jvm process through the jstack command. With the Grep command, you can find the hexadecimal thread id information, and you can quickly find out where the most CPU-intensive code is. Under
simple explanation, the series of threads which jstack content:
800 nid = 0x7d9b waiting on condition [0x0000000046f66000]
" DboServiceProcessor-4 -thread-295" daemon prio=10 tid=0x00002aab047a9800 nid=0x7d9b waiting on condition [0x0000000046f66000]
nid : The corresponding linux operating system tid, which is the hexadecimal number converted
tid: This should be the unique address location in the jmm memory specification of jvm. If you use some memory data of jvm in detail, you can't use it, so let's put it down
the top command
command:
top -Hp pid
the results show:
and in front of the effect it, and you can track in real time Get the thread that consumes the most CPU in the specified process. Then use the previous method to extract the corresponding thread stack information.
Analyzing I /O bottlenecks
mpstat command
command: mpstat -P ALL 1 1000
The results show:
Note the %iowait column inside, the time it takes for the CPU to wait for an I/O operation. This value continues to be high and is usually caused by an I/O bottleneck.
This parameter allows you to visually see if there is a bottleneck in the current I/O operation.
iostat command
Command:
iostat -m - x 1 1000
% iowait you can observe the same data corresponding to the CPU, in addition iostat also provides some more detail of I /O status data, such as the more important are: < Br>
avgqu-sz : The average queue length of the requests that were issued to the device. (The length of the request for the disk queue, 2, 3 is normal. It can be understood as the load of the cpu)
await : The average time (in milliseconds) for I/O requests issued to the device to be served. (represents the total time of an I/O operation from wait to completion)
svctm and %util Both represent the time spent processing the I/O request and the proportion of time spent on the CPU. When judging whether it is a bottleneck, these two parameters are not the main
r/sw/s and rMB/s wMB/s are some states representing the I/O handled by the current system. The former is what we often say. Tps, the latter is throughput. This is also a performance metric for evaluating a system
pid command
Command:
pidstat -p pid -u -d -t -w -h 1 1000
the results show:
is a very useful command may be analyzed based on performance data corresponding to when a process, including CPU, I /O, IR, CS and the like, can facilitate the development of more refined Observe the operating state of the system. However, pidstat seems to be in some newer versions of the 2.6 kernel, you need to install the sysstat package.
Under ubuntu, you can install it via sudo apt-get install sysstat.
sar command
command:
sar -x pid 1 1000
several
sar may designate corresponding pid, attention fixed Parameters, not as powerful as pidstat. I can't see the corresponding I/O, IR and other information.
The sar function can override the related functions of mpstat and iostat.
dstat command
command:
dstat -y --tcp 1 1000
can be more easily seen by dstat --tcp The current state of tcp, do not need to look at netstat -nat every time
Other commands
netstat -natp : View the corresponding network link, pay attention to Recv-Q, Send-Q , State.
lsof -p pid : Find the file handle of the corresponding pid
lsof -i : 80 : Find which process the corresponding port is occupied by
lsof /tmp/1.txt : Find which file is occupied by the corresponding file
tcpdump /wireshark: capture packet analysis tool
jstat /jmap /jstack /jps and other series of java monitoring commands
Finally
If you want to do some performance tuning work, be sure to use some tools to pay attention to the corresponding state. With the linux command, you can easily observe some peripheral states such as CPU, I/O, network, etc., and most of them can solve most problems. Some internal state monitoring of jvm requires fine-grained observation with some unique tools.
The configuration steps of Telnet service are as follows: First, install telnet package (usually tw
under RedHat Enterprise Linux server 5.4 First, system environment operating system: RedHat Enterp
When using a computer, it often interacts with some encrypted documents, such as Zip, Rar, and even
See many online how to ask how to configure the linux system nat Internet, now write an article here
How to do disk space shortage, linux disk cleaning method
Four Reasons for SELinux Warnings Details
Redis-benchmark performance test tutorial
U disk linux installation skills
Open source operating system beyond Linux
Windows and Linux dual system uninstall Linux system
Linux common compression decompression command set
Play World of Warcraft with Wine under Ubuntu Linux
Linux system management and maintenance - scp command
Postfix+dovecot+maildrop+mailscanner+clamav+spamassassin build
How to remove the boot menu left behind the installation of Win7
Really hide files and ban files
Introduction to Windows 2000 Outlook Express Window
Win8 create VHD virtual disk graphic tutorial
SNMP service network security in Win2003
Retrieving the "Recently Used Project" in the "Start" menu of the Win7 system
How to solve the automatic downloading software program of Win7 system
Windows 8 system Defender conflicts with security software how to disable