2019-05-16
一次有趣的High load average排查暨深刻理解Linux系统负载

当Linux服务运行慢的时候,我们一般都是用top命令看看当前CPU使用率以及哪些进程占用了资源等。资深一些管理员,会通过查看load average来查看系统负载以评估系统是越来越慢还是会越来越快。正常情况下,系统没有活跃进程时,系统的负载是0, 如下所示(用uptime):

1
2
# uptime
03:07am up 0:38, 2 users, load average: 0.00, 0.00, 0.02

可是有一次有台机会变慢,load average很高,但是CPU 使用率接近于0,如下所示:

1
2
3
4
5
6
top - 05:15:28 up  2:25,  2 users,  load average: 18.44, 18.47, 18.32
Tasks: 144 total, 1 running, 143 sleeping, 0 stopped, 0 zombie
%Cpu0 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu1 : 0.0 us, 0.8 sy, 0.0 ni, 99.2 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu2 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
%Cpu3 : 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st

如果是使用vmstats/iostat,都没办法发现是什么导致High load average和机器变慢。在大量Google之后,最终怀疑到是因为有一个NFS mount的服务器可能down了,大量的df进程导致系统High load average,下面我们细细分析个中原因。

Read More

2019-05-14
Linux虚拟内存介绍以及glibc内存管理机制窥探

Long ago, I have presentd an overview of virtual memory in Linux kernel and memory memory in glibc. Now i am lazy to write these again, so I try to upload the PPT in images. As you know, each pages has details knowledge could be digged into, so you have further view, please google the keywords.

Overview of VM system in Linux

VM

Read More