Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

CPU Monitoring of operating system performance Monitoring

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Operating system performance monitoring

In addition to the performance of the application itself, the server program depends on the performance of the server itself. Today you learned how to monitor the performance of the server. Includes: CPU, memory, network IO, and disk utilization.

Let's take a look at how to monitor CPU today.

CPU Monitoring CPU Utilization vmstat Command oot@SSP001: [/ root] vmstatprocs-memory- swap---io---- system---cpu- r b swpd free buff cache si so bi bo in cs us sy id wa st 00 79484 90085784 591052 79229448 00 6 001 1 97 00

The CPU part represents the monitoring data of cpu.

The specific meaning is as follows:

The name means us user mode CPU time (percentage) user timesy system state CPU time (percentage) system timeid idle CPU time (percentage) Time spent idlewa waiting for IO CPU time Time spent waiting for IOst doesn't know what the heck, ignores Time stolen from a virtual machine. Prior to Linux 2.6.11, unknown.

It should be noted in the parameters that if the wa is high, it means that the waiting time of the IO is high, which may be the bottleneck of the disk IO.

Mpstat [root@Hwseeker-Adx02] # mpstat-P ALL 10 1Linux 2.6.32-573.3.1.el6.x86_64 (Hwseeker-Adx02) January 23, 2018 _ x86room6424 CPU 16:45:03 CPU% usr% nice% sys% iowait% irq% soft% steal% guest% idle 16: 45: 13 all 1.96 0.00 0.68 0. 00 0.00 0.15 0.00 0.00 97.2116: 45 minutes 13 seconds 0 8.32 0.00 1.83 0.00 0.00 0.20 0.00 0.00 89.6416 hours 45 minutes 13 seconds 1.2.21 0.00 0.00 0.00 96.9816 hours 45 minutes 13 seconds 22. 23 0.00 0.61 0.00 0.00 0.30 0.00 0.00 96.8616: 45 minutes 13 seconds 3 3.25 0.00 1.32 0.00 0.00 0.61 0.00 94.8216: 45 minutes 13 seconds 4 0.20 0.00 0.00 0.00 99. 6016: 45: 13 seconds 5 6.38 0.00 2.13 0.00 0.00 1.01 0.00 0.00 90.4916: 45 minutes 13 seconds 6 1.20 0.00 0.40 0.00 0.00 0.00 98.4016: 45 13 seconds 7 0.60 0.00 0.00 0.00. 10 0.00 0.00 98.6916: 45 minutes 13 seconds 8 0.60 0.00 0.40 0.00 0.00 0.00 98.9916 hours 45 minutes 13 seconds 9 0.20 0.00 0.00 0.00 99.7016 99.7016 minutes 10 1.10 0.00 0.20 0.00 0.00 0.00 98.7016: 45 minutes 13 seconds 11 0.50 0.00 0.40 0.00 0.00 0.00 99.1016 hours 45 minutes 13 seconds 12 2.92 0.00 0.00 0.00 96.2716 hours 45 minutes 13 seconds 13 0. 50 0.00 0.50 0.00 0.00 0.10 0.00 98.9016: 45: 13 seconds 14 6.90 0.00 1.93 0.00 0.00 0.61 0.00 0.00 90.5716: 45 minutes 13 seconds 15 5.99 0.00 1.42 0.00 0.00 0.61 0.00 0.00 91.9816 45 minutes 13 seconds 16 0.10 0.00 0.10 0.00 0.00 0.00 99.8016: 45 minutes 13 seconds 17 0.71 0.00 0.00 0.00 0.10 0.00 0.00 98.3816: 45 minutes 13 seconds 18 0.40 0.00 0.30 0.00 0.00 0.00 0.00 99.3016: 45 minutes 13 seconds 19 0.60 0.00 0.50 0.00 0.00 0.00 98.8916 hours 45 minutes 13 seconds 20 0.30 0.00 0.40 0.00 0.00 0.00 99.3016 hours 45 minutes 13 seconds 21 0.20 0.00 0.30 0.00 0. 00. 00 0.00 0.00 0.00 99.5016: 45 minutes 13 seconds 22 0.30 0.00 0.00 0.00 99.4016: 45 minutes 13 seconds 23 1.31 0.00 0.00 0.00 98.29

Mpstat can check the status of each cpu, and you can find out whether some threads in the application consume more CPU cycles than others, or whether all threads basically divide the CPU cycles equally. If all threads divide the CPU cycle equally, it means that the application is scalable.

You can use the mpstat command on your own Baidu. What we need to focus on here is the% usr/%sys/%iowait field.

Top command [root@Hwseeker-Adx02 ~] # toptop-16:51:46 up 762days, 16:33, 1 user, load average: 0.65,0.40, 0.29Tasks: 598 total, 1 running, 596 sleeping, 0 stopped, 1 zombieCpu (s): 1.6%us, 0.7%sy, 0.0%ni, 97.5%id, 0.0%wa, 0.0%hi, 0.1%si, 0.0%stMem: 132119192 k total, 130669000k used 1450192k free, 1157188k buffersSwap: 131071996k total, 4017704k used, 127054292k free 88117860k cached PID USER PR NI VIRT RES SHR S% CPU% MEM TIME+ COMMAND36660 root 20 24.3g 4.7g 13m S 16.83.7 440108 java36888 root 20 24.4g 4.7g 13m S 14.8 3.4332 java52318 root 2002353m 1.0g 39m S 5.9 0.86739927 firefox 5631 root 20 01252m 29m 1924 S 2.0.0 2243402 main21114 root 200 150m 13m 1364 S 2.0 0.0 664:08.76 redis-server

The top command can not only monitor user-mode CPU, system-mode cpu, free rate, but also list processes according to cpu utilization, which is very convenient to use.

CPU program scheduling queue

Which lightweight processes are in the run queue waiting for the available CPU. It is very helpful to judge whether the CPU is running at full load.

What about the length of the scheduling queue?

For a long time, the length of the run queue has been more than twice the number of cores in cpu, which requires attention, but no immediate action. If it is 3 to 4 times or more than the cpu audit for a long time, immediate action is needed.

Solution:

1. Add cpu

two。 Analyze the running application and improve the utilization rate. Such as reducing the frequency of garbage collection. Vmstatoot@SSP001: [/ root] vmstatprocs-memory- swap---io---- system---cpu-r b swpd free buff cache si so bi bo in cs us sy id wa st0 0 79484 90085784 591052 79229448 00 6 001 1 97 00

Where the r column is the queue length.

The content of this blog is compiled from the reading notes of the authoritative Guide to Java performance Optimization.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report