Skip to content

Commit 5b1dd04

Browse files
author
wangyazhou
committed
docs: 更新 eBPF 和 Linux 性能监控文档
- 更新 bcc 文档,添加 biosnoop 命令示例 - 更新 Linux 性能监控文档,增加 pcstat 工具介绍- 新增 Go 内存管理文档,介绍三色标记法- 更新 Linux 常见问题排查手段,增加总和性排查方法 - 修正文档中的图片路径
1 parent bf30bb0 commit 5b1dd04

File tree

5 files changed

+45
-4
lines changed

5 files changed

+45
-4
lines changed

eBPF/bcc.adoc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ endif::rootpath[]
1111

1212
== bcc
1313

14-
image::../image/eBPF/image-2025-02-21-15-49-53-474.png[]
14+
image::eBPF/image-2025-02-21-15-49-53-474.png[]
1515

1616
=== 命令
1717

@@ -105,10 +105,20 @@ TIME DISK %RND %SEQ COUNT KBYTES
105105

106106
==== biosnoop
107107

108-
用于追踪块设备 I/O(即磁盘 I/O),并为每次 I/O 操作打印一行输出。这对于分析磁盘性能、识别慢速 I/O 操作以及了解系统中磁盘活动的具体细节非常有用。
108+
用于追踪块设备 I/O(即磁盘 I/O),并为每次 I/O 操作打印一行输出。这对于分析磁盘性能、识别慢速 I/O 操作以及了解系统中磁盘活动的具体细节非常有用。进程的每次操作都会打印一次,这样就能根据延时来查看具体进程的I/O性能。
109109

110110
- biosnoop: 检查单个I/O
111111

112+
[source,bash]
113+
----
114+
[root@k8smaster-ims tools]# ./biosnoop
115+
TIME(s) COMM PID DISK T SECTOR BYTES LAT(ms)
116+
0.000000 etcd 13383 sda W 2206026528 8192 0.52
117+
0.000965 jbd2/dm-0-8 551 sda W 1259008848 86016 0.70
118+
0.001762 kworker/1:2 3671312 sda W 1259009016 4096 0.47
119+
0.008779 etcd 13383 sda W 42709832 4096 0.41
120+
----
121+
112122
==== biotop
113123

114124
用于实时显示哪些进程正在进行磁盘 I/O 操作。它类似于 top 命令,但专门针对磁盘 I/O 进行了优化,能够帮助用户识别出系统中占用大量磁盘资源的进程。

go/memory.adoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
3+
4+
5+
6+
7+
8+
9+
10+
11+
12+
13+
=== go内存三色标记法
14+
15+
https://www.ardanlabs.com/blog/2018/12/garbage-collection-in-go-part1-semantics.html[Garbage Collection In Go : Part I - Semantics]
16+
http://ardanlabs.com/blog/2019/05/garbage-collection-in-go-part2-gctraces.html[Garbage Collection In Go : Part II - GC Traces]
17+
https://www.ardanlabs.com/blog/2019/07/garbage-collection-in-go-part3-gcpacing.html[Garbage Collection In Go : Part III - GC Pacing]

linux/linux-performance.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ endif::rootpath[]
2727
`cat /proc/cpuinfo` 查看CPU信息
2828

2929

30-
==== pcstat
30+
=== pcstat
3131

3232
用来查看一个文件当前在内核中的缓存情况,以及缓存的命中率,通常用于排查那些需要读取文件频繁的程序,这些程序经常因为文件缓存命中率低而产生性能问题。
3333

34+
> pcstat 命令使用go语言实现,github地址 https://github.com/tobert/pcstat[pcstat]
35+
3436
[source,bash]
3537
----
3638
pcstat /tmp/test.txt

linux/常见问题及排查手段.adoc

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,24 @@ endif::rootpath[]
1313
== linux常见问题及排查手段
1414

1515

16+
=== 总和性排查
17+
18+
一个命令查看出到底是CPU还是内存还是网络或者磁盘出现的问题,可以查看一下
19+
20+
[source,bash]
21+
----
22+
# 每一行都会显示CPU使用,内存使用,磁盘读写,网络使用的情况, c: CPU,m: 内存,d: 磁盘,n: 网络
23+
dstat -cmrdn
24+
----
25+
26+
27+
1628
=== CPU
1729

1830

1931
=== 内存
2032

21-
=== 内存缺页
33+
==== 内存缺页
2234

2335
在 Linux 系统中,缺页中断(Page Fault)是操作系统内存管理中的一个重要概念。当程序试图访问一个不在物理内存中的页面时,就会发生缺页中断。根据页面是否需要从磁盘加载到内存,缺页中断可以分为两种类型:主缺页(Major Page Fault)和次缺页(Minor Page Fault)。
2436

web/gin.adoc

Whitespace-only changes.

0 commit comments

Comments
 (0)