Linux系统卡慢之调优方法

  • 一、查看当前系统装态
  • 二、对系统各进程排序
  • 三、分析进程状态
  • 四、测试系统状态

一、查看当前系统装态

二、对系统各进程排序

三、分析进程状态

四、测试系统状态

一、查看当前系统装态
1.查看当前进场状态,系统负载过高,系统相当卡慢

top - 23:08:47 up 11:01,  1 user,  load average: 925.72, 927.01, 917.04
Tasks: 3418 total, 1046 running, 2372 sleeping,   0 stopped,   0 zombie
%Cpu(s): 35.5 us, 63.1 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.6 hi,  0.9 si,  0.0 st
MiB Mem :   3918.5 total,    476.1 free,   2900.9 used,    541.5 buff/cache
MiB Swap:   2048.0 total,   2048.0 free,      0.0 used.    728.1 avail Mem PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
119640 root      20   0   69460  10468   4152 R   0.7   0.3   0:04.92 top                                                                      10 root      20   0       0      0      0 R   0.4   0.0   1:34.59 rcu_sched                                                                1244 mysql     20   0 1357880 397984  31000 S   0.2   9.9   1:11.76 mysqld                                                                   1506 apache    20   0 1343960  11600   6384 S   0.2   0.3   0:05.48 httpd                                                                    3043 root      20   0   12832   3168   2848 S   0.2   0.1   0:01.96 log.sh                                                                   3402 root      20   0   12832   3232   2908 S   0.2   0.1   0:01.68 log.sh                                                                   3859 root      20   0   12832   3252   2924 S   0.2   0.1   0:03.43 log.sh                                                                   7872 root      20   0   12832   3232   2912 S   0.2   0.1   0:03.72 log.sh                                                                   10920 root      20   0   12832   3256   2932 S   0.2   0.1   0:08.76 log.sh                                                                   16900 root      20   0   12832   3260   2940 S   0.2   0.1   0:01.77 log.sh                                                                   28647 root      20   0   12832   3208   2884 S   0.2   0.1   0:01.27 log.sh                                                                   29094 root      20   0   12832   3164   2840 S   0.2   0.1   0:00.58 log.sh                                                                   34566 root      20   0   12832   3252   2932 S   0.2   0.1   0:01.88 log.sh                                                                   36878 root      20   0   12832   3172   2848 S   0.2   0.1   0:03.52 log.sh                                                                   38955 root      20   0   12832   3204   2876 S   0.2   0.1   0:02.67 log.sh                                                                   40783 root      20   0       0      0      0 I   0.2   0.0   0:00.76 kworker/0:2-events                                                       41112 root      20   0   12832   3164   2840 S   0.2   0.1   0:01.57 log.sh                                                                   41605 root      20   0   12832   3272   2948 S   0.2   0.1   0:01.26 log.sh                                                                   41856 root      20   0   12832   3264   2940 S   0.2   0.1   0:06.64 log.sh                                                                   42967 root      20   0   12832   3124   2796 S   0.2   0.1   0:00.47 log.sh                                                                   43692 root      20   0   12832   3236   2908 S   0.2   0.1   0:09.47 log.sh                                                                   44485 root      20   0   12832   3220   2892 S   0.2   0.1   0:10.31 log.sh                                                                   57271 root      20   0   12832   3268   2940 S   0.2   0.1   0:06.53 log.sh                                                                   60624 root      20   0   12832   3168   2848 S   0.2   0.1   0:03.01 log.sh                                                                   64120 root      20   0   12832   3324   3000 S   0.2   0.1   0:04.11 log.sh                                                                   68358 root      20   0   12832   3296   2972 S   0.2   0.1   0:01.30 log.sh                                                                   68491 root      20   0   12832   3172   2848 S   0.2   0.1   0:02.51 log.sh                                                                   72158 root      20   0   12832   3192   2872 S   0.2   0.1   0:01.18 log.sh                                                                   75374 root      20   0   12832   3332   3008 S   0.2   0.1   0:09.26 log.sh                                                                   78726 root      20   0   12832   3196   2876 S   0.2   0.1   0:01.96 log.sh                                                                   85466 root      20   0   12832   3228   2900 S   0.2   0.1   0:04.82 log.sh                                                                   91415 root      20   0   12832   3268   2940 S   0.2   0.1   0:03.14 log.sh                                                                   97916 root      20   0   12832   3228   2904 S   0.2   0.1   0:00.88 log.sh                                                                   98944 root      20   0   12832   3172   2844 S   0.2   0.1   0:03.37 log.sh
107246 root      20   0   12832   3228   2900 S   0.2   0.1   0:03.63 log.sh
108035 root      20   0   12832   3228   2904 S   0.2   0.1   0:05.34 log.sh
116940 root      20   0   12832   3212   2892 S   0.2   0.1   0:04.01 log.sh
117082 root      20   0   12832   3236   2912 S   0.2   0.1   0:03.63 log.sh
122689 root      20   0   12832   3220   2896 S   0.2   0.1   0:12.25 log.sh
123703 root      20   0   12832   3252   2928 S   0.2   0.1   0:03.88 log.sh                                                                   1 root      20   0  197248  15648   9004 S   0.0   0.4   0:05.68 systemd                                                                  2 root      20   0       0      0      0 S   0.0   0.0   0:00.03 kthreadd
[root@control scripts]# free -mtotal        used        free      shared  buff/cache   available
Mem:           3918        2920         456          15         541         708
Swap:          2047

二、对系统各进程排序
1.对cpu占有率进行降序排列

[root@control scripts]#
[root@control scripts]# ps aux --sort=-%cpu |head -n 20
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      35004  1.0  0.1  58044  5104 pts/0    R+   23:30   0:00 ps aux --sort=-%cpu
root     121033  0.3  0.0      0     0 ?        I    23:30   0:00 [kworker/0:3-events]
root         10  0.2  0.0      0     0 ?        I    12:07   1:37 [rcu_sched]
root      48011  0.2  0.0      0     0 ?        I    23:26   0:00 [kworker/0:0-cgroup_pidlist_destroy]
mysql      1244  0.1  9.9 1357880 397984 ?      Ssl  12:07   1:14 /usr/libexec/mysqld --basedir=/usr
root      72606  0.1  0.0      0     0 ?        I    23:20   0:00 [kworker/0:1-xfs-cil/nvme0n1p5]
root          1  0.0  0.3 197248 15652 ?        Ss   12:07   0:05 /usr/lib/systemd/systemd --switched-root --system --deserialize 18
root          2  0.0  0.0      0     0 ?        S    12:07   0:00 [kthreadd]
root          3  0.0  0.0      0     0 ?        I<   12:07   0:00 [rcu_gp]
root          4  0.0  0.0      0     0 ?        I<   12:07   0:00 [rcu_par_gp]
root          6  0.0  0.0      0     0 ?        I<   12:07   0:00 [kworker/0:0H-kblockd]
root          8  0.0  0.0      0     0 ?        I<   12:07   0:00 [mm_percpu_wq]
root          9  0.0  0.0      0     0 ?        S    12:07   0:11 [ksoftirqd/0]
root         11  0.0  0.0      0     0 ?        S    12:07   0:00 [migration/0]
root         12  0.0  0.0      0     0 ?        S    12:07   0:00 [watchdog/0]
root         13  0.0  0.0      0     0 ?        S    12:07   0:00 [cpuhp/0]
root         15  0.0  0.0      0     0 ?        S    12:07   0:00 [kdevtmpfs]
root         16  0.0  0.0      0     0 ?        I<   12:07   0:00 [netns]
root         17  0.0  0.0      0     0 ?        S    12:07   0:00 [kauditd]

2.对内存占有大小进行降序排列

[root@control scripts]# ps aux --sort=-%mem |head -n 20
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
mysql      1244  0.1  9.9 1357880 397984 ?      Ssl  12:07   1:14 /usr/libexec/mysqld --basedir=/usr
gdm        1955  0.0  3.5 2843996 141372 tty1   Sl+  12:07   0:14 /usr/bin/gnome-shell
gdm        2042  0.0  1.3 259244 52788 tty1     S+   12:07   0:00 /usr/bin/Xwayland :1024 -rootless -terminate -accessx -core -listen 4 -listen 5 -displayfd 6
gdm        2117  0.0  1.3 1240264 52700 tty1    Sl+  12:07   0:00 /usr/libexec/gsd-media-keys
gdm        2125  0.0  1.2 745352 51832 tty1     Sl+  12:07   0:00 /usr/libexec/gsd-power
gdm        2109  0.0  1.2 809320 51508 tty1     Sl+  12:07   0:03 /usr/libexec/gsd-color
gdm        2094  0.0  1.2 646964 51092 tty1     Sl+  12:07   0:00 /usr/libexec/gsd-xsettings
gdm        2146  0.0  1.2 581116 50628 tty1     Sl+  12:07   0:00 /usr/libexec/gsd-wacom
gdm        2115  0.0  1.2 645832 50520 tty1     Sl+  12:07   0:00 /usr/libexec/gsd-keyboard
gdm        2103  0.0  1.2 496092 50064 tty1     Sl+  12:07   0:00 /usr/libexec/gsd-clipboard
gdm        2071  0.0  1.2 496540 50048 tty1     Sl   12:07   0:00 /usr/libexec/ibus-x11 --kill-daemon
root        986  0.0  1.0 1167316 41504 ?       Ssl  12:07   0:00 /usr/sbin/libvirtd
root        883  0.0  0.8 202764 35484 ?        S    12:07   0:00 /usr/libexec/sssd/sssd_nss --uid 0 --gid 0 --logger=files
root        909  0.0  0.8 252904 35064 ?        Ssl  12:07   0:00 /usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopid
root        976  0.0  0.7 401624 30708 ?        Ssl  12:07   0:03 /usr/libexec/platform-python -Es /usr/sbin/tuned -l -P
polkitd     796  0.0  0.6 1780272 26932 ?       Ssl  12:07   0:17 /usr/lib/polkit-1/polkitd --no-debug
root        948  0.0  0.4 407028 18992 ?        Ssl  12:07   0:00 /usr/sbin/NetworkManager --no-daemon
root       1463  0.0  0.4 377288 18600 ?        Ssl  12:07   0:01 /usr/sbin/rsyslogd -n
root        630  0.0  0.4  93740 16316 ?        Ss   12:07   0:02 /usr/lib/systemd/systemd-journald

3.对top内存进行排序

top - 23:33:59 up 11:26,  1 user,  load average: 970.20, 946.03, 935.18
Tasks: 3753 total, 1442 running, 2311 sleeping,   0 stopped,   0 zombie
%Cpu(s): 34.5 us, 64.2 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.5 hi,  0.8 si,  0.0 st
MiB Mem :   3918.5 total,    414.7 free,   2962.2 used,    541.7 buff/cache
MiB Swap:   2048.0 total,   2048.0 free,      0.0 used.    666.9 avail Mem PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                  1244 mysql     20   0 1357880 397984  31000 S   0.3   9.9   1:14.84 mysqld                                                                   1955 gdm       20   0 2843996 141372  83436 S   0.0   3.5   0:14.18 gnome-shell                                                              2042 gdm       20   0  259244  52788  36968 S   0.0   1.3   0:00.27 Xwayland                                                                 2117 gdm       20   0 1240264  52700  41848 S   0.0   1.3   0:00.21 gsd-media-keys                                                           2125 gdm       20   0  745352  51832  41280 S   0.0   1.3   0:00.22 gsd-power                                                                2109 gdm       20   0  809320  51508  40704 S   0.0   1.3   0:03.53 gsd-color                                                                2094 gdm       20   0  646964  51092  40404 S   0.0   1.3   0:00.12 gsd-xsettings                                                            2146 gdm       20   0  581116  50628  39968 S   0.0   1.3   0:00.12 gsd-wacom                                                                2115 gdm       20   0  645832  50520  40268 S   0.0   1.3   0:00.12 gsd-keyboard                                                             2103 gdm       20   0  496092  50064  39860 S   0.0   1.2   0:00.11 gsd-clipboard                                                            2071 gdm       20   0  496540  50048  39896 S   0.0   1.2   0:00.09 ibus-x11                                                                 986 root      20   0 1167316  41504  30084 S   0.0   1.0   0:00.47 libvirtd                                                                 883 root      20   0  202764  35484  34132 S   0.0   0.9   0:00.85 sssd_nss                                                                 909 root      20   0  252904  35064  14704 S   0.0   0.9   0:00.65 firewalld                                                                976 root      20   0  401624  30708  14352 S   0.0   0.8   0:03.27 tuned                                                                    796 polkitd   20   0 1780272  26932  16804 S   0.0   0.7   0:17.74 polkitd                                                                  948 root      20   0  407028  18992  15840 S   0.0   0.5   0:00.68 NetworkManager                                                           1463 root      20   0  377288  18600   9692 S   0.0   0.5   0:01.53 rsyslogd                                                                 630 root      20   0   93740  16316  12884 S   0.0   0.4   0:02.09 systemd-journal                                                          1 root      20   0  197248  15652   9004 S   0.0   0.4   0:05.75 systemd                                                                  2273 root       9 -11  382676  14532   8916 S   0.0   0.4   0:00.55 pulseaudio                                                               667 root      20   0  120404  14484   8384 S   0.0   0.4   0:00.58 systemd-udevd                                                            1926 gdm       20   0  561288  14204  11996 S   0.0   0.4   0:00.22 gnome-session-b                                                          1503 apache    20   0 1475088  13648   6384 S   0.0   0.3   0:06.50 httpd                                                                    2111 gdm       20   0  360724  13476  11644 S   0.0   0.3   0:00.01 gsd-datetime                                                             882 root      20   0  191820  12708   9996 S   0.0   0.3   0:00.23 sssd_be                                                                  2140 gdm       20   0  457052  12656   9028 S   0.0   0.3   0:01.10 gsd-smartcard                                                            795 root      20   0  226576  12520  10948 S   0.0   0.3   0:17.73 vmtoolsd                                                                 811 root      20   0  533576  12152  10168 S   0.0   0.3   0:00.18 udisksd                                                                  1504 apache    20   0 1343960  11600   6384 S   0.0   0.3   0:05.80 httpd                                                                    1506 apache    20   0 1343960  11600   6384 S   0.0   0.3   0:05.70 httpd                                                                    1375 gdm       20   0 1139416  11464   8480 S   0.0   0.3   0:00.14 pulseaudio

4.对top的cpu进行排序

top - 23:35:11 up 11:28,  1 user,  load average: 925.18, 937.49, 933.01
Tasks: 3350 total, 1213 running, 2137 sleeping,   0 stopped,   0 zombie
%Cpu(s): 35.2 us, 63.5 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.4 hi,  0.9 si,  0.0 st
MiB Mem :   3918.5 total,    500.3 free,   2876.1 used,    542.1 buff/cache
MiB Swap:   2048.0 total,   2048.0 free,      0.0 used.    752.7 avail Mem PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                  40859 root      20   0   68624   9492   4124 R   0.9   0.2   0:00.89 top                                                                      1244 mysql     20   0 1357880 397984  31000 S   0.4   9.9   1:14.99 mysqld
121033 root      20   0       0      0      0 I   0.4   0.0   0:00.93 kworker/0:3-events                                                       10 root      20   0       0      0      0 R   0.2   0.0   1:38.46 rcu_sched                                                                2901 root      20   0   12832   3212   2892 S   0.2   0.1   0:06.89 log.sh                                                                   11316 root      20   0   12832   3252   2932 S   0.2   0.1   0:04.92 log.sh                                                                   11338 root      20   0   12832   3188   2864 S   0.2   0.1   0:00.42 log.sh                                                                   11588 root      20   0   12832   3344   3016 S   0.2   0.1   0:09.57 log.sh                                                                   18141 root      20   0   12832   3232   2908 S   0.2   0.1   0:02.09 log.sh                                                                   19853 root      20   0   12832   3184   2860 S   0.2   0.1   0:01.83 log.sh                                                                   22687 root      20   0   12832   3248   2924 S   0.2   0.1   0:13.91 log.sh                                                                   25858 root      20   0   12832   3316   2988 S   0.2   0.1   0:00.65 log.sh                                                                   26270 root      20   0   12832   3316   2996 S   0.2   0.1   0:03.01 log.sh                                                                   28339 root      20   0   12832   3264   2940 S   0.2   0.1   0:05.26 log.sh                                                                   32276 root      20   0   12832   3272   2952 S   0.2   0.1   0:01.92 log.sh                                                                   37834 root      20   0   12832   3332   3012 S   0.2   0.1   0:04.11 log.sh                                                                   40221 root      20   0   12832   3208   2888 S   0.2   0.1   0:03.18 log.sh                                                                   53572 root      20   0   12832   3264   2936 S   0.2   0.1   0:01.10 log.sh                                                                   62329 root      20   0   12832   3112   2788 S   0.2   0.1   0:03.67 log.sh                                                                   68358 root      20   0   12832   3296   2972 S   0.2   0.1   0:01.46 log.sh                                                                   72045 root      20   0   12832   3100   2776 S   0.2   0.1   0:10.57 log.sh                                                                   75636 root      20   0   12832   3168   2840 S   0.2   0.1   0:03.24 log.sh                                                                   75933 root      20   0   12832   3264   2940 S   0.2   0.1   0:00.46 log.sh                                                                   78521 root      20   0   12832   3268   2944 S   0.2   0.1   0:03.96 log.sh                                                                   83423 root      20   0   12832   3248   2924 S   0.2   0.1   0:01.05 log.sh                                                                   86644 root      20   0   12832   3148   2824 S   0.2   0.1   0:02.52 log.sh                                                                   89434 root      20   0   12832   3168   2840 S   0.2   0.1   0:00.44 log.sh                                                                   94082 root      20   0   12832   3264   2940 S   0.2   0.1   0:00.61 log.sh                                                                   99308 root      20   0   12832   3156   2832 S   0.2   0.1   0:05.37 log.sh
101858 root      20   0   12832   3176   2848 S   0.2   0.1   0:11.43 log.sh
107071 root      20   0   12832   3160   2836 S   0.2   0.1   0:01.44 log.sh
107192 root      20   0   12832   3260   2940 S   0.2   0.1   0:01.06 log.sh
108720 root      20   0   12832   3180   2848 S   0.2   0.1   0:09.35 log.sh
109394 root      20   0   12832   3212   2880 S   0.2   0.1   0:09.07 log.sh
117366 root      20   0   12832   3256   2936 S   0.2   0.1   0:00.34 log.sh
122689 root      20   0   12832   3220   2896 S   0.2   0.1   0:12.39 log.sh
127515 root      20   0   12832   3180   2856 S   0.2   0.1   0:03.92 log.sh
127665 root      20   0   12832   3240   2912 S   0.2   0.1   0:07.83 log.sh
130999 root      20   0   12832   3212   2888 S   0.2   0.1   0:01.11 log.sh                                                                   1 root      20   0  197248  15652   9004 S   0.0   0.4   0:05.75 systemd                                                                  2 root      20   0       0      0      0 S   0.0   0.0   0:00.03 kthreadd                                                                 3 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_gp

三、分析进程状态
经上述操作分析,发现内存及cpu资源负载过高原因有两个,
1.MYSQL数据库占有一定资源。
2.log.sh脚本重复运行,占有大量资源。

四、处理方法
1.kill所有的log.sh进程

ps -ef | grep log.sh |grep -v grep | awk '{print $2}' | xargs kill -15

2.停止mysql服务器

[root@control scripts]# systemctl stop mysqld.service
[root@control scripts]# systemctl status mysqld.service
● mysqld.service - MySQL 8.0 database serverLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: inactive (dead) since Thu 2021-04-29 23:50:12 CST; 10s agoProcess: 87312 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS)Process: 2015 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)Process: 1244 ExecStart=/usr/libexec/mysqld --basedir=/usr (code=exited, status=0/SUCCESS)Process: 1110 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)Process: 995 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)Main PID: 1244 (code=exited, status=0/SUCCESS)

3.查看当前系统状态

top - 23:51:03 up 11:44,  1 user,  load average: 0.23, 175.83, 544.20
Tasks: 267 total,   1 running, 266 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.7 sy,  0.0 ni, 99.3 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :   3918.5 total,   2592.0 free,    885.3 used,    441.3 buff/cache
MiB Swap:   2048.0 total,   2048.0 free,      0.0 used.   2791.3 avail Mem PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                  1015 root      20   0   36092   3696   2796 S   0.3   0.1   0:00.51 crond                                                                    87359 root      20   0   64016   4988   4072 R   0.3   0.1   0:00.02 top                                                                      1 root      20   0  197248  15656   9004 S   0.0   0.4   0:06.34 systemd                                                                  2 root      20   0       0      0      0 S   0.0   0.0   0:00.03 kthreadd                                                                 3 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_gp                                                                   4 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_par_gp                                                               6 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/0:0H-kblockd                                                     8 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 mm_percpu_wq                                                             9 root      20   0       0      0      0 S   0.0   0.0   0:12.46 ksoftirqd/0                                                              10 root      20   0       0      0      0 I   0.0   0.0   1:39.59 rcu_sched                                                                11 root      rt   0       0      0      0 S   0.0   0.0   0:00.00 migration/0                                                              12 root      rt   0       0      0      0 S   0.0   0.0   0:00.00 watchdog/0                                                               13 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp/0                                                                  15 root      20   0       0      0      0 S   0.0   0.0   0:00.00 kdevtmpfs                                                                16 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 netns                                                                    17 root      20   0       0      0      0 S   0.0   0.0   0:00.01 kauditd                                                                  18 root      20   0       0      0      0 S   0.0   0.0   0:00.12 khungtaskd                                                               19 root      20   0       0      0      0 S   0.0   0.0   0:00.00 oom_reaper                                                               20 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 writeback                                                                21 root      20   0       0      0      0 S   0.0   0.0   0:00.00 kcompactd0                                                               22 root      25   5       0      0      0 S   0.0   0.0   0:00.00 ksmd                                                                     23 root      39  19       0      0      0 S   0.0   0.0   0:02.19 khugepaged                                                               24 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 crypto                                                                   25 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kintegrityd                                                              26 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kblockd                                                                  27 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 md                                                                       28 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 edac-poller                                                              29 root      rt   0       0      0      0 S   0.0   0.0   0:00.00 watchdogd                                                                44 root      20   0       0      0      0 S   0.0   0.0   0:00.00 kswapd0                                                                  95 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kthrotld                                                                 96 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 irq/24-pciehp                                                            97 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 irq/25-pciehp                                                            98 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 irq/26-pciehp                                                            99 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 irq/27-pciehp                                                            100 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 irq/28-pciehp                                                            101 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 irq/29-pciehp                                                            102 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 irq/30-pciehp                                                            103 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 irq/31-pciehp                                                            104 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 irq/32-pciehp                                                            105 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 irq/33-pciehp                                                            106 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 irq/34-pciehp                                                            107 root     -51   0       0      0      0 S   0.0   0.0   0:00.00 irq/35-pciehp

四、测试系统状态
1.查看CPU和内存状态

[root@control scripts]# ps aux --sort=-%cpu |head -n 20
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         10  0.2  0.0      0     0 ?        I    12:07   1:39 [rcu_sched]
root          1  0.0  0.3 197248 15656 ?        Ss   12:07   0:06 /usr/lib/systemd/systemd --switched-root --system --deserialize 18
root          2  0.0  0.0      0     0 ?        S    12:07   0:00 [kthreadd]
root          3  0.0  0.0      0     0 ?        I<   12:07   0:00 [rcu_gp]
root          4  0.0  0.0      0     0 ?        I<   12:07   0:00 [rcu_par_gp]
root          6  0.0  0.0      0     0 ?        I<   12:07   0:00 [kworker/0:0H-kblockd]
root          8  0.0  0.0      0     0 ?        I<   12:07   0:00 [mm_percpu_wq]
root          9  0.0  0.0      0     0 ?        S    12:07   0:12 [ksoftirqd/0]
root         11  0.0  0.0      0     0 ?        S    12:07   0:00 [migration/0]
root         12  0.0  0.0      0     0 ?        S    12:07   0:00 [watchdog/0]
root         13  0.0  0.0      0     0 ?        S    12:07   0:00 [cpuhp/0]
root         15  0.0  0.0      0     0 ?        S    12:07   0:00 [kdevtmpfs]
root         16  0.0  0.0      0     0 ?        I<   12:07   0:00 [netns]
root         17  0.0  0.0      0     0 ?        S    12:07   0:00 [kauditd]
root         18  0.0  0.0      0     0 ?        S    12:07   0:00 [khungtaskd]
root         19  0.0  0.0      0     0 ?        S    12:07   0:00 [oom_reaper]
root         20  0.0  0.0      0     0 ?        I<   12:07   0:00 [writeback]
root         21  0.0  0.0      0     0 ?        S    12:07   0:00 [kcompactd0]
root         22  0.0  0.0      0     0 ?        SN   12:07   0:00 [ksmd]
[root@control scripts]# ps aux --sort=-%mem |head -n 20
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
gdm        1955  0.0  3.5 2843996 141424 tty1   Sl+  12:07   0:16 /usr/bin/gnome-shell
gdm        2042  0.0  1.3 259244 52788 tty1     S+   12:07   0:00 /usr/bin/Xwayland :1024 -rootless -terminate -accessx -core -listen 4 -listen 5 -displayfd 6
gdm        2117  0.0  1.3 1240264 52700 tty1    Sl+  12:07   0:00 /usr/libexec/gsd-media-keys
gdm        2125  0.0  1.2 745352 51832 tty1     Sl+  12:07   0:00 /usr/libexec/gsd-power
gdm        2109  0.0  1.2 809320 51508 tty1     Sl+  12:07   0:03 /usr/libexec/gsd-color
gdm        2094  0.0  1.2 646964 51092 tty1     Sl+  12:07   0:00 /usr/libexec/gsd-xsettings
gdm        2146  0.0  1.2 581116 50628 tty1     Sl+  12:07   0:00 /usr/libexec/gsd-wacom
gdm        2115  0.0  1.2 645832 50520 tty1     Sl+  12:07   0:00 /usr/libexec/gsd-keyboard
gdm        2103  0.0  1.2 496092 50064 tty1     Sl+  12:07   0:00 /usr/libexec/gsd-clipboard
gdm        2071  0.0  1.2 496540 50048 tty1     Sl   12:07   0:00 /usr/libexec/ibus-x11 --kill-daemon
root        986  0.0  1.0 1167316 41504 ?       Ssl  12:07   0:00 /usr/sbin/libvirtd
root        883  0.0  0.8 202764 35484 ?        S    12:07   0:00 /usr/libexec/sssd/sssd_nss --uid 0 --gid 0 --logger=files
root        909  0.0  0.8 252904 35064 ?        Ssl  12:07   0:00 /usr/libexec/platform-python -s /usr/sbin/firewalld --nofork --nopid
root        976  0.0  0.7 401624 30708 ?        Ssl  12:07   0:03 /usr/libexec/platform-python -Es /usr/sbin/tuned -l -P
polkitd     796  0.0  0.6 1780404 27536 ?       Ssl  12:07   0:19 /usr/lib/polkit-1/polkitd --no-debug
root       1463  0.0  0.4 377288 19020 ?        Ssl  12:07   0:01 /usr/sbin/rsyslogd -n
root        948  0.0  0.4 407028 18992 ?        Ssl  12:07   0:00 /usr/sbin/NetworkManager --no-daemon
root        630  0.0  0.4  93740 16844 ?        Ss   12:07   0:02 /usr/lib/systemd/systemd-journald
root          1  0.0  0.3 197248 15656 ?        Ss   12:07   0:06 /usr/lib/systemd/systemd --switched-root --system --deserialize 18
[root@control scripts]# top
top - 23:51:24 up 11:44,  1 user,  load average: 0.16, 164.44, 532.60
Tasks: 267 total,   1 running, 266 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :   3918.5 total,   2592.0 free,    885.2 used,    441.3 buff/cache
MiB Swap:   2048.0 total,   2048.0 free,      0.0 used.   2791.3 avail Mem

系统已恢复正常,测试shell命令行终端有无卡顿缓慢情况,经测试恢复正常。

Linux系统卡慢之调优方法相关推荐

  1. linux系统分配文件夹内存,详解Linux系统内存知识及调优方案

    内存是计算机中重要的部件之一,它是与CPU进行沟通的桥梁.计算机中所有程序的运行都是在内存中进行的,因此内存的性能对计算机的影响非常大.内存作用是用于暂时存放CPU中的运算数据,以及与硬盘等外部存储器 ...

  2. Linux系统上的程序调优思路概要

    目录 文件系统 Linux内核 应用程序 架构设计 性能监控 性能测试 CPU 内存 网络 磁盘IO 文件系统 Linux内核 应用程序 架构设计 性能监控 性能测试 CPU 内存 网络 磁盘IO

  3. Linux 系统级开启文件句柄 调优

    系统级开启文件句柄  max-file系统级别的能够打开的文件句柄的数量,Centos7默认是794168. Max-file 与 ulimit -n 的区别 max-file 表示系统级别的能够打开 ...

  4. linux mysql数据库优化_MySQL_Linux下MySQL数据库性能调优方法,以下的环境具备一定的代表性 - phpStudy...

    Linux下MySQL数据库性能调优方法 以下的环境具备一定的代表性,可以说是中小企业一般配置和工作环境.希望通过本文能让大家理解Linux下MySQL数据库性能调优方法. 硬件准备环境: 硬盘: 1 ...

  5. 透明大页相关内核参数_Alibaba Cloud Linux 2系统中与透明大页THP相关的性能调优方法...

    免责声明:本文档可能包含第三方产品信息,该信息仅供参考.阿里云对第三方产品的性能.可靠性以及操作可能带来的潜在影响,不做任何暗示或其他形式的承诺. 概述 本文主要介绍在Alibaba Cloud Li ...

  6. 多用户用linux会很卡顿吗,新手学Linux系统,解决Linux系统卡顿的方法

    很多新手刚从事linux运维的同学,经常会问我使用linux很卡的时候该怎么办?今天小编就为大家带来解决Linux系统卡顿的方法,下面一起来看看吧. 1.检查磁盘运用状况 df -h 当发现磁盘运用率 ...

  7. [译] Linux 网络栈监控和调优:发送数据(2017)

    转载自:http://arthurchiao.art/blog/tuning-stack-tx-zh/ 点击阅读原文 Published at 2018-12-17 | Last Update 202 ...

  8. JVM内存调优原则及几种JVM内存调优方法

    JVM内存调优原则及几种JVM内存调优方法 1.堆大小设置. 2.回收器选择. 1.在对JVM内存调优的时候不能只看操作系统级别Java进程所占用的内存,这个数值不能准确的反应堆内存的真实占用情况,因 ...

  9. 面向关系数据库的智能索引调优方法

    面向关系数据库的智能索引调优方法 人工智能技术与咨询 来源:<软件学报> ,作者邱 涛等 摘 要:数据库索引是关系数据库系统实现快速查询的有效方式之一.智能索引调优技术可以有效地对数据库实 ...

最新文章

  1. nginx响应高并发参数配置
  2. 天翼云从业认证课后习题(3.2天翼云存储产品和3.4云数据库)
  3. linux查找替换grep以及正则表达式
  4. Java 8中的功能接口是什么? @功能注释和示例
  5. [python3.3]Python异步Socket编程【TCP】
  6. Apache nifi 集群安装
  7. Linux下安装jboss并设置自启动服务
  8. pillow 初级用法
  9. 【DP + 卖股票】LeetCode 309. Best Time to Buy and Sell Stock with Cooldown
  10. dlna和miracast可以共存吗_Airplay、Miracast、DLNA传输原理的底层搭建
  11. ​windows系统——更改系统音效为钢铁侠贾维斯​
  12. 宝塔linux面板mysql数据库误删恢复过程
  13. SQLAPI++ Library 4.2.1 VS2010破解版
  14. hadoop 运行过程中出现Call to localhost/127.0.0.1:9000 failed on connection exception错误。
  15. android app闪退的原因分析,打开一个app就闪退解决方法
  16. 队列-链表-C语言实现
  17. 强大的全文本搜索工具——AnyTXT Searcher
  18. Tableau权限设置
  19. R语言对数线性模型loglm函数_用R语言进行数据分析:常规和广义线性模型
  20. 【C#】WPF实现经典纸牌游戏,适合新手入门

热门文章

  1. lintcode480- Binary Tree Paths- easy
  2. Bottle源码阅读(3) HeaderDict
  3. Android分包方案multidex
  4. QT ToolBar 工具栏浮动状态
  5. 【加】德鲁·卡宾森 - 质量效应2:升天(2013年6月7日)
  6. c:if判断参数是否为空
  7. jquery学习资源
  8. MySQL order by 是怎么工作的?
  9. 编制一个c语言成绩记录簿_C语言学到什么程度能写推箱子
  10. a3国际服服务器未响应,A3幸存者国际服