Skip to content

Commit 06a9fe7

Browse files
committed
cpu
1 parent 3c7846a commit 06a9fe7

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

docs/data-store/MySQL/MySQL-FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ BLOB 保存二进制数据,TEXT 保存字符数据。
401401

402402

403403

404-
# MySQL 事务
404+
## MySQL 事务
405405

406406
MySQL 事务主要用于处理操作量大,复杂度高的数据。比如说,在人员管理系统中,你删除一个人员,你即需要删除人员的基本资料,也要删除和该人员相关的信息,如信箱,文章等等,这样,这些数据库操作语句就构成一个事务!
407407

docs/java/JVM/Reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Java 中引入四种引用的目的是让程序自己决定对象的生命周期
5454

5555
### JDK 8中的 UML关系图
5656

57-
![Finalizer.png](https://i.loli.net/2020/05/07/AqsHUeYCOf2hzZc.png)
57+
![](https://tva1.sinaimg.cn/large/007S8ZIlly1genmesm4hej30lw08lmx1.jpg)
5858

5959
FinalReference 类是包内可见,其他三种引用类型均为 public,可以在应用程序中直接使用。
6060

docs/others/CPU.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
假如生产环境出现CPU占用过高,请谈谈你的分析思路和定位?
2+
3+
你是你说看日志,那就只能回家等通知了,
4+
5+
6+
7+
1. 先用 top 命令找到 CPU 占比最高的
8+
9+
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gesbmulx11j316w0m4qdc.jpg)
10+
11+
2. ps -ef 或者 jps 进一步定位,得知是一个怎样的一个后台
12+
13+
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gesbo6ikkdj31100d242b.jpg)
14+
15+
2. 定位到具体代码或线程
16+
17+
ps -mp 进程 -o THREAD,tid,time
18+
19+
参数解释:
20+
21+
- -m 显示所有进程
22+
- -p pid 进程使用 cpu 的时间
23+
- -o 该参数后是用户自定义格式
24+
25+
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gesbqgwjjvj30x80n8th3.jpg)
26+
27+
3. 将需要的线程 ID 转换为 16进制格式(英文小写格式)
28+
29+
线程在内存中跑是 16 进制的,pritf "%x\n" 有问题的线程 ID (或者计算器转换下)
30+
31+
4. jstack 进程 ID | grep tid(16进制线程 ID 小写英文) -A60
32+
33+
-A60 打印出前 60 行
34+
35+
![](https://tva1.sinaimg.cn/large/007S8ZIlly1gesbvn06ypj31b80loap1.jpg)

images/java.jpg

-29.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)