avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 14063 ylp 20 0 9260488 4.627g 11976 S 776.1 29.8 117:41.66 java2.2. Locating the problem threadUse the PS-MP pid-o thread,tid,time command to view the thread condition of the process and find that the process has a high
Use an automated shell script to find detailed thread information for CPU usage
After some interceptor code is added to the project, the CPU alarm shows that the CPU usage exceeds 100%;
If you want to find out which code consumes too much resources, find a blog post on the I
This article uses Java processes to illustrate 1. View the CPU usage of the Java process and its threads First use PS-EF to find the Java process ID # ps-ef|grep Java Then use the top-p PID command to view the CPU used by the process, for example: [[Email protected] ~]# top-
threadUse the PS-MP pid-o thread,tid,time command to view the thread condition of the process and find that the process has a high number of thread occupancy rates[Email protected] ~]$Ps-MP 14063-OTHREAD,TidTimeUSER%CpuPriSCNTWchanUSERSYSTEMTIDTimeYLP 361------02: 05: 58YLP 0.0 19-Futex_--14063 00: 00: 00YLP 0.0 19-poll_s--14064 00: 00: 00YLP 44.5 19----14065 00: 15: 30YLP 44.5 19----14066 00: 15: 30YLP 44
In Linux, how does one view high CPU usage threads? in Linux, the top tool can display the average cpu usage (user, nice, system, idle, iowait, irq, softirq, etc .), the usage of each cpu is displayed. However, the
, Cut command By default is tab-delimited, but PS aux display the string blank is a space instead of tab, we will use a space to split, Some of the string is a number of spaces, here the-f8 parameter is to intercept the 8th string (some system may be 6th), this string is the CPU utilization of MySQL!Maybe you have a question, now that you've got the CPU
Shell programming is very powerful!
When the site traffic is large, MySQL is under a high pressure. When the CPU usage of MySQL exceeds 300%, it cannot provide services, and it is almost stuck. At this time, the best way is to restart the MySQL service. This is unpredictable. We don't know when MySQL's usage reaches 300%.ProgramRegular judgment is more reliable
power.For general users, you can also use the Nice directive to prioritize the execution of your program, but you can only make the nice value more elevated.There are two ways to set a nice value for a program:1, given a nice value when starting the execution of the program, with the Nice command2. Adjust the nice value of the PID of a running program with the Renice commandIt is usually backed up by adjusting the nice value so that it does not occupy a lot of system resources.Cases:Nice-n tar
intercept the MySQL CPU value, Cut command By default is tab-delimited, but PS aux display the string blank is a space instead of tab, we will use a space to split, Some of the string is a number of spaces, here the-f8 parameter is to intercept the 8th string (some system may be 6th), this string is the CPU utilization of MySQL!Maybe you have a question, now tha
+%sy +%ni) = (100%-), which What you see is the rate of CPU work.Why is load high and CPU usage low?That's very likely the process of D states is very large, we use the following command to look at the number of processes (or threads) in R state and D state, only a few processes (or threads) have found R state, and the process (or thread) of the D state has a la
Under Linux, the top tool can display the average CPU utilization (USER,NICE,SYSTEM,IDLE,IOWAIT,IRQ,SOFTIRQ,ETC.), which shows the utilization of each CPU. However, this situation may occur when the CPU utilization of each thread cannot be displayed, and the total CPU utilization is high, but the user or system of the
Thanks to grapeot for its inspiration, powershell is used to draw a pie chart showing the CPU usage of processes. I also made a Linux version. I am not familiar with gnuplot and do not know if I can draw a pie chart. Here I use a simple and easy-to-use Google API. First, let's take a look at the static pie chart of the Google chart API: Let's take a look at the pie chart in the visualization API just re
This article describes the way to get CPU usage of the system process under Linux through the Go language. Share to everyone for your reference. The specific analysis is as follows:
This code uses Linux's System command PS to analyze CPU usage, as follows:
Copy Code c
Osptasktemplatefunc (void*) () #7 0x00d4780e in Start_thread () fr Om/lib/tls/i686/cmov/libpthread.so.0#8 0x002027ee in Clone () from/lib/tls/i686/cmov/libc.so.6PS + strace Get process ID 21465 ps-e |grep CMU 4996? 00:00:25 cmu_fjga_sp3 21465 pts/5 00:08:10 CMU gets thread time, which accounts for the most CPU epollrecvtask 21581ps-el |grep 2146521465 21579 pts/5 00: 00:00 CamApp21465 21580 pts/5 00:00:00
Troubleshoot high CPU usage in Java
THE top Command finds that a process occupies 100% of the CPU. Use the ps command to determine which process is faulty. View the CPU usage list of the thread.
#
Installing CPULimitInstall using source code# cd/tmp# wget ' http://downloads.sourceforge.net/cpulimit/cpulimit-1.1.tar.gz '# tar cpulimit-1.1.tar.gz# CD cpulimit-1.1# make# CP cpulimit/usr/local/sbin/# RM-RF CPULimit *debian/ubuntu UsersMore convenient installation with Apt-get $ sudo apt-get update$ sudo apt-get install CPULimit How do I use CPULimit?Restrict Firefox to use 30% CPU utilization # CPULIMIT-E Firefox-l 30 Limit process number 1313 for
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.