04 say Basics: often said CPU context switching is what is meant (at)

Excessive context switching will shorten the process time is running vmstat 1 1: analyze memory usage, cpu context switch and interrupt times. cs per second, the number of context switches, in the number of interrupts per second, or wait for the number of r cpu running processes, b process interrupts sleep state. pidstat -w 5: Check the details of each process. cswch (voluntary per second) number of context switches, such as low system resources, nvcswch involuntary context switches per second, such as cpu time slice expires or high-priority thread Case Study: sysbench: multi-threaded benchmark test tools, simulation context terminal switch 1: sysbench --threads = 10 --max-time = 300 threads run terminal 2: vmstat 1: sys column occupies 84% ​​of the kernel is occupied mainly described, ur occupy 16%; r ready queue 8; in interrupt processing 1w , CS handover 139w ==> too much waiting process, frequent context switches, cpu occupancy rate increased kernel terminal 3: pidstat -w -u 1: sysbench cpu occupancy of 100% (- wt child threads found excessive handover), the other the process leading to context switches watch -d cat / proc / interupts: View another indicator of the number of interrupts, read / proc / interupts found rescheduling interrupt the fastest speed res change summary: cswch belabor IO resource issues, nvcswch too Description excessive competition for scheduling multi-cpu, cpu interruptions increases explain the interrupted program calls

 

Log on to the server, now how about the system load. High, then there are three cases, first cpu usage, followed by io usage, then that is both high.

cpu usage rate, may indeed be high usage rate, it may not be high but the actual treatment process too much context switching frequently, it may be in the process thread context switching frequently

io usage rate, indicating io request is relatively large, it may be file io, network io.

Tools:
System load: uptime (watch -d uptime) look at the three stages of the average load
system overall situation: mpstat (mpstat -p ALL 3) to view each cpu current overall situation, the user can look at the focus mode, kernel mode, and io wait three parameters
average overall system context switches case: vmstat (vmstat 3) can look at the focus r (or wait for the process be carried out), b (uninterruptible process / io process), in (interruptions), cs (context switch number)
to view detailed context switching situation: pidstat (pidstat -w (the process of switching index) / - u (cpu usage indicators) / - wt (thread context switching index)) Note the voluntary context switch, context switching or passive
io use case: iostat

tool simulation scenarios:
Stress: process simulation, IO
SysBench: analog threads

Guess you like

Origin www.cnblogs.com/xiaobao2/p/11592414.html