V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
YaD2x
V2EX  ›  服务器

凌晨服务器出现大量关于主机 cpu 上下文切换次数过高的告警信息,切换次数 30000/s 左右,请问如何排查是什么原因造成的,服务器的短板在哪里?

  •  
  •   YaD2x · 17 天前 · 326 次点击

    告警信息:Context switching is growing on the node (> 15000 / CPU / s) VALUE = 15003.080701754385

    配置:16g RAM 2 核心的 CPU

    pidstat -w 3 10 > /tmp/pidstat.out

    Linux 3.10.0-1160.108.1.el7.x86_64 (taiGUo-test) 	2024 年 04 月 29 日 	_x86_64_	(2 CPU)
    
    10 时 16 分 15 秒   UID       PID   cswch/s nvcswch/s  Command
    10 时 16 分 18 秒     0         1      0.66      0.00  systemd
    10 时 16 分 18 秒     0         6      1.99      0.00  ksoftirqd/0
    10 时 16 分 18 秒     0         9     98.34      0.00  rcu_sched
    10 时 16 分 18 秒     0        11      0.33      0.00  watchdog/0
    10 时 16 分 18 秒     0        12      0.33      0.00  watchdog/1
    10 时 16 分 18 秒     0        14      1.66      0.00  ksoftirqd/1
    10 时 16 分 18 秒     0       256      1.66      0.00  kworker/1:1H
    10 时 16 分 18 秒     0       261      8.64      0.00  kworker/0:1H
    10 时 16 分 18 秒     0       268     11.96      0.66  jbd2/vda1-8
    10 时 16 分 18 秒     0       588     23.92      0.00  supervisord
    10 时 16 分 18 秒     0      1193     11.30      0.00  AliYunDun
    10 时 16 分 18 秒     0      1204     30.90      0.00  AliYunDunMonito
    10 时 16 分 18 秒   997      1321     23.26      0.00  redis-server
    10 时 16 分 18 秒   996      7955      1.33      0.00  nginx
    10 时 16 分 18 秒   996      7956     15.95      0.00  nginx
    10 时 16 分 18 秒     0     11140      7.97      0.00  kworker/1:0
    10 时 16 分 18 秒     0     15700      0.33      0.00  sshd
    10 时 16 分 18 秒     0     21146      2.66      0.00  kworker/0:2
    10 时 16 分 18 秒    27     21149      1.33      0.00  mysqld
    10 时 16 分 18 秒     0     25059      1.33      0.00  sshd
    10 时 16 分 18 秒     0     25245      1.33      0.00  tail
    10 时 16 分 18 秒     0     26479      0.33      0.00  pidstat
    
    10 时 16 分 18 秒   UID       PID   cswch/s nvcswch/s  Command
    10 时 16 分 21 秒     0         1      1.00      0.00  systemd
    10 时 16 分 21 秒     0         6      2.33      0.00  ksoftirqd/0
    10 时 16 分 21 秒     0         9     99.33      0.00  rcu_sched
    10 时 16 分 21 秒     0        11      0.33      0.00  watchdog/0
    10 时 16 分 21 秒     0        12      0.33      0.00  watchdog/1
    10 时 16 分 21 秒     0        14      3.33      0.00  ksoftirqd/1
    10 时 16 分 21 秒     0       256      3.67      0.00  kworker/1:1H
    10 时 16 分 21 秒     0       261      8.33      0.00  kworker/0:1H
    10 时 16 分 21 秒     0       268     10.00      0.00  jbd2/vda1-8
    10 时 16 分 21 秒     0       588      7.33      0.00  supervisord
    10 时 16 分 21 秒     0      1127      0.33      0.00  AliYunDunUpdate
    10 时 16 分 21 秒     0      1193     11.00      0.00  AliYunDun
    10 时 16 分 21 秒     0      1204     30.00      0.00  AliYunDunMonito
    10 时 16 分 21 秒     0      1319      0.33      0.00  rsyslogd
    10 时 16 分 21 秒   997      1321     12.33      0.00  redis-server
    10 时 16 分 21 秒   996      7956      0.67      0.00  nginx
    10 时 16 分 21 秒     0     11140      8.33      0.00  kworker/1:0
    10 时 16 分 21 秒     0     15700      0.33      0.00  sshd
    10 时 16 分 21 秒     0     18171      0.33      0.00  kworker/u4:2
    10 时 16 分 21 秒     0     21146      2.00      0.00  kworker/0:2
    10 时 16 分 21 秒     0     25059      1.33      0.00  sshd
    10 时 16 分 21 秒     0     25245      1.33      0.00  tail
    10 时 16 分 21 秒     0     26479      0.33      0.00  pidstat
    
    10 时 16 分 21 秒   UID       PID   cswch/s nvcswch/s  Command
    10 时 16 分 24 秒     0         1      0.67      0.00  systemd
    10 时 16 分 24 秒     0         6      1.33      0.00  ksoftirqd/0
    10 时 16 分 24 秒     0         9    105.00      0.00  rcu_sched
    10 时 16 分 24 秒     0        11      0.33      0.00  watchdog/0
    10 时 16 分 24 秒     0        12      0.33      0.00  watchdog/1
    10 时 16 分 24 秒     0        14      1.33      0.00  ksoftirqd/1
    10 时 16 分 24 秒     0       256      1.33      0.00  kworker/1:1H
    10 时 16 分 24 秒     0       261     19.00      0.00  kworker/0:1H
    10 时 16 分 24 秒     0       268     20.33      0.33  jbd2/vda1-8
    10 时 16 分 24 秒     0       588     16.00      0.00  supervisord
    10 时 16 分 24 秒     0      1193     10.33      0.00  AliYunDun
    10 时 16 分 24 秒     0      1204     30.33      0.00  AliYunDunMonito
    10 时 16 分 24 秒   997      1321     16.33      0.00  redis-server
    10 时 16 分 24 秒   996      7955      0.33      0.00  nginx
    10 时 16 分 24 秒   996      7956      1.33      0.00  nginx
    10 时 16 分 24 秒     0     11140      9.00      0.00  kworker/1:0
    10 时 16 分 24 秒     0     21146      2.67      0.00  kworker/0:2
    10 时 16 分 24 秒    27     21149      0.67      0.00  mysqld
    10 时 16 分 24 秒     0     25059      2.67      0.00  sshd
    10 时 16 分 24 秒     0     25245      2.67      0.00  tail
    10 时 16 分 24 秒     0     26479      0.33      0.00  pidstat
    
    10 时 16 分 24 秒   UID       PID   cswch/s nvcswch/s  Command
    10 时 16 分 27 秒     0         1      1.00      0.00  systemd
    10 时 16 分 27 秒     0         6      3.67      0.00  ksoftirqd/0
    10 时 16 分 27 秒     0         9    113.33      0.00  rcu_sched
    10 时 16 分 27 秒     0        14      2.33      0.00  ksoftirqd/1
    10 时 16 分 27 秒     0       256      2.00      0.00  kworker/1:1H
    10 时 16 分 27 秒     0       261     15.00      0.00  kworker/0:1H
    10 时 16 分 27 秒     0       268     14.33      0.00  jbd2/vda1-8
    10 时 16 分 27 秒     0       588     19.33      0.00  supervisord
    10 时 16 分 27 秒     0      1193     11.00      0.00  AliYunDun
    10 时 16 分 27 秒     0      1204     31.33      0.00  AliYunDunMonito
    10 时 16 分 27 秒   997      1321     21.67      0.00  redis-server
    10 时 16 分 27 秒   996      7955      6.00      0.00  nginx
    10 时 16 分 27 秒   996      7956      6.67      0.00  nginx
    10 时 16 分 27 秒     0     11140     11.33      0.00  kworker/1:0
    10 时 16 分 27 秒     0     18171      0.33      0.00  kworker/u4:2
    10 时 16 分 27 秒     0     21146      8.00      0.00  kworker/0:2
    10 时 16 分 27 秒    27     21149      0.33      0.00  mysqld
    10 时 16 分 27 秒     0     25059     10.00      0.00  sshd
    10 时 16 分 27 秒     0     25245      9.67      1.33  tail
    10 时 16 分 27 秒     0     26479      0.33      0.00  pidstat
    
    10 时 16 分 27 秒   UID       PID   cswch/s nvcswch/s  Command
    10 时 16 分 30 秒     0         1      0.67      0.00  systemd
    10 时 16 分 30 秒     0         6      0.33      0.00  ksoftirqd/0
    10 时 16 分 30 秒     0         9    103.67      0.00  rcu_sched
    10 时 16 分 30 秒     0        11      0.33      0.00  watchdog/0
    10 时 16 分 30 秒     0        12      0.33      0.00  watchdog/1
    10 时 16 分 30 秒     0        14      1.33      0.00  ksoftirqd/1
    10 时 16 分 30 秒     0        20      0.33      0.00  khungtaskd
    10 时 16 分 30 秒     0       256      0.67      0.00  kworker/1:1H
    10 时 16 分 30 秒     0       261      2.33      0.00  kworker/0:1H
    10 时 16 分 30 秒     0       268      3.00      0.00  jbd2/vda1-8
    10 时 16 分 30 秒     0       588     33.00      0.00  supervisord
    10 时 16 分 30 秒     0      1127      0.33      0.00  AliYunDunUpdate
    10 时 16 分 30 秒     0      1193     11.00      0.00  AliYunDun
    10 时 16 分 30 秒     0      1204     30.67      0.00  AliYunDunMonito
    10 时 16 分 30 秒   997      1321     12.00      0.00  redis-server
    10 时 16 分 30 秒     0     11140      8.33      0.00  kworker/1:0
    10 时 16 分 30 秒     0     18171      0.33      0.00  kworker/u4:2
    10 时 16 分 30 秒     0     21146      4.33      0.00  kworker/0:2
    10 时 16 分 30 秒     0     25059      3.33      0.00  sshd
    10 时 16 分 30 秒     0     25245      1.67      1.00  tail
    10 时 16 分 30 秒     0     26479      0.33      0.00  pidstat
    
    10 时 16 分 30 秒   UID       PID   cswch/s nvcswch/s  Command
    10 时 16 分 33 秒     0         1      0.67      0.00  systemd
    10 时 16 分 33 秒     0         6      1.00      0.00  ksoftirqd/0
    10 时 16 分 33 秒     0         9    106.67      0.00  rcu_sched
    10 时 16 分 33 秒     0        11      0.33      0.00  watchdog/0
    10 时 16 分 33 秒     0        12      0.33      0.00  watchdog/1
    10 时 16 分 33 秒     0        14      0.67      0.00  ksoftirqd/1
    10 时 16 分 33 秒     0       256      0.33      0.00  kworker/1:1H
    10 时 16 分 33 秒     0       588      1.00      0.00  supervisord
    10 时 16 分 33 秒     0      1193     10.33      0.00  AliYunDun
    10 时 16 分 33 秒     0      1204     30.00      0.00  AliYunDunMonito
    10 时 16 分 33 秒   997      1321     10.33      0.00  redis-server
    10 时 16 分 33 秒   996      7956      6.00      0.00  nginx
    10 时 16 分 33 秒     0     11140      7.00      0.00  kworker/1:0
    10 时 16 分 33 秒     0     21146      2.33      0.00  kworker/0:2
    10 时 16 分 33 秒    27     21149      0.33      0.00  mysqld
    10 时 16 分 33 秒     0     26479      0.33      0.00  pidstat
    
    10 时 16 分 33 秒   UID       PID   cswch/s nvcswch/s  Command
    10 时 16 分 36 秒     0         1      1.00      0.00  systemd
    10 时 16 分 36 秒     0         6      5.67      0.00  ksoftirqd/0
    10 时 16 分 36 秒     0         9    118.33      0.00  rcu_sched
    10 时 16 分 36 秒     0        11      0.33      0.00  watchdog/0
    10 时 16 分 36 秒     0        12      0.33      0.00  watchdog/1
    10 时 16 分 36 秒     0        14      4.00      0.00  ksoftirqd/1
    10 时 16 分 36 秒     0       256      3.33      0.00  kworker/1:1H
    10 时 16 分 36 秒     0       261     19.00      0.00  kworker/0:1H
    10 时 16 分 36 秒     0       268     21.67      1.67  jbd2/vda1-8
    10 时 16 分 36 秒     0       588     18.33      0.67  supervisord
    10 时 16 分 36 秒     0      1193     11.00      0.00  AliYunDun
    10 时 16 分 36 秒     0      1204     30.33      0.00  AliYunDunMonito
    10 时 16 分 36 秒   997      1321     14.33      0.00  redis-server
    10 时 16 分 36 秒   996      7956     10.33      0.00  nginx
    10 时 16 分 36 秒     0     11140      7.67      0.00  kworker/1:0
    10 时 16 分 36 秒     0     18171      0.33      0.00  kworker/u4:2
    10 时 16 分 36 秒     0     21146     22.00      0.00  kworker/0:2
    10 时 16 分 36 秒    27     21149      0.33      0.00  mysqld
    10 时 16 分 36 秒     0     25059     13.33      0.00  sshd
    10 时 16 分 36 秒     0     25245     10.67      0.67  tail
    10 时 16 分 36 秒     0     26479      0.33      0.00  pidstat
    
    10 时 16 分 36 秒   UID       PID   cswch/s nvcswch/s  Command
    10 时 16 分 39 秒     0         1      0.67      0.00  systemd
    10 时 16 分 39 秒     0         6      1.33      0.00  ksoftirqd/0
    10 时 16 分 39 秒     0         9    119.67      0.00  rcu_sched
    10 时 16 分 39 秒     0        14      1.00      0.00  ksoftirqd/1
    10 时 16 分 39 秒     0       256      1.00      0.00  kworker/1:1H
    10 时 16 分 39 秒     0       261      3.33      0.00  kworker/0:1H
    10 时 16 分 39 秒     0       268      4.00      0.00  jbd2/vda1-8
    10 时 16 分 39 秒     0       588      1.00      0.00  supervisord
    10 时 16 分 39 秒     0      1127      0.33      0.00  AliYunDunUpdate
    10 时 16 分 39 秒     0      1193     11.00      0.00  AliYunDun
    10 时 16 分 39 秒     0      1204     30.00      0.00  AliYunDunMonito
    10 时 16 分 39 秒   997      1321     10.00      0.00  redis-server
    10 时 16 分 39 秒     0     11140      6.00      0.00  kworker/1:0
    10 时 16 分 39 秒     0     21146      2.00      0.00  kworker/0:2
    10 时 16 分 39 秒    27     21149      0.33      0.00  mysqld
    10 时 16 分 39 秒     0     26479      0.33      0.00  pidstat
    
    10 时 16 分 39 秒   UID       PID   cswch/s nvcswch/s  Command
    10 时 16 分 42 秒     0         1      1.00      0.00  systemd
    10 时 16 分 42 秒     0         6      1.67      0.00  ksoftirqd/0
    10 时 16 分 42 秒     0         9     99.00      0.00  rcu_sched
    10 时 16 分 42 秒     0        11      0.33      0.00  watchdog/0
    10 时 16 分 42 秒     0        12      0.33      0.00  watchdog/1
    10 时 16 分 42 秒     0        14      0.67      0.00  ksoftirqd/1
    10 时 16 分 42 秒     0       261      1.00      0.00  kworker/0:1H
    10 时 16 分 42 秒     0       268      1.33      0.00  jbd2/vda1-8
    10 时 16 分 42 秒     0       588      1.00      0.00  supervisord
    10 时 16 分 42 秒     0      1193     10.67      0.00  AliYunDun
    10 时 16 分 42 秒     0      1204     30.33      0.00  AliYunDunMonito
    10 时 16 分 42 秒   997      1321     10.67      0.00  redis-server
    10 时 16 分 42 秒     0     11140      6.00      0.00  kworker/1:0
    10 时 16 分 42 秒     0     18171      0.33      0.00  kworker/u4:2
    10 时 16 分 42 秒     0     21146      2.00      0.00  kworker/0:2
    10 时 16 分 42 秒    27     21149      0.33      0.00  mysqld
    10 时 16 分 42 秒     0     26479      0.33      0.00  pidstat
    
    10 时 16 分 42 秒   UID       PID   cswch/s nvcswch/s  Command
    10 时 16 分 45 秒     0         1      0.67      0.00  systemd
    10 时 16 分 45 秒     0         6      1.33      0.00  ksoftirqd/0
    10 时 16 分 45 秒     0         9    115.33      0.00  rcu_sched
    10 时 16 分 45 秒     0        11      0.33      0.00  watchdog/0
    10 时 16 分 45 秒     0        12      0.33      0.00  watchdog/1
    10 时 16 分 45 秒     0        14      1.67      0.00  ksoftirqd/1
    10 时 16 分 45 秒     0       256      0.67      0.00  kworker/1:1H
    10 时 16 分 45 秒     0       261      0.67      0.00  kworker/0:1H
    10 时 16 分 45 秒     0       268      1.33      0.00  jbd2/vda1-8
    10 时 16 分 45 秒     0       588      1.00      0.00  supervisord
    10 时 16 分 45 秒     0      1127      0.33      0.00  AliYunDunUpdate
    10 时 16 分 45 秒     0      1193     10.67      0.00  AliYunDun
    10 时 16 分 45 秒     0      1204     30.67      0.00  AliYunDunMonito
    10 时 16 分 45 秒   997      1321     11.67      0.00  redis-server
    10 时 16 分 45 秒     0     11140      6.00      0.00  kworker/1:0
    10 时 16 分 45 秒     0     18171      0.33      0.00  kworker/u4:2
    10 时 16 分 45 秒     0     21146      2.00      0.00  kworker/0:2
    10 时 16 分 45 秒    27     21149      0.33      0.00  mysqld
    10 时 16 分 45 秒     0     26479      0.33      0.00  pidstat
    
    平均时间:   UID       PID   cswch/s nvcswch/s  Command
    平均时间:     0         1      0.80      0.00  systemd
    平均时间:     0         6      2.07      0.00  ksoftirqd/0
    平均时间:     0         9    107.86      0.00  rcu_sched
    平均时间:     0        11      0.27      0.00  watchdog/0
    平均时间:     0        12      0.27      0.00  watchdog/1
    平均时间:     0        14      1.80      0.00  ksoftirqd/1
    平均时间:     0        20      0.03      0.00  khungtaskd
    平均时间:     0       256      1.47      0.00  kworker/1:1H
    平均时间:     0       261      7.73      0.00  kworker/0:1H
    平均时间:     0       268      8.80      0.27  jbd2/vda1-8
    平均时间:     0       588     12.20      0.07  supervisord
    平均时间:     0      1127      0.13      0.00  AliYunDunUpdate
    平均时间:     0      1193     10.83      0.00  AliYunDun
    平均时间:     0      1204     30.46      0.00  AliYunDunMonito
    平均时间:     0      1319      0.03      0.00  rsyslogd
    平均时间:   997      1321     14.26      0.00  redis-server
    平均时间:   996      7955      0.77      0.00  nginx
    平均时间:   996      7956      4.10      0.00  nginx
    平均时间:     0     11140      7.76      0.00  kworker/1:0
    平均时间:     0     15700      0.07      0.00  sshd
    平均时间:     0     18171      0.20      0.00  kworker/u4:2
    平均时间:     0     21146      5.00      0.00  kworker/0:2
    平均时间:    27     21149      0.40      0.00  mysqld
    平均时间:     0     25059      3.20      0.00  sshd
    平均时间:     0     25245      2.73      0.30  tail
    平均时间:     0     26479      0.33      0.00  pidstat
    

    有大佬帮忙看看是哪个服务造成的吗,主机对 linux 一知半解,难以解决这类性能问题。

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1244 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 18:10 · PVG 02:10 · LAX 11:10 · JFK 14:10
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.