当前位置:网站首页>Flame diagram analysis Flink backpressure
Flame diagram analysis Flink backpressure
2022-07-26 06:57:00 【wending-Y】
List of articles
The phenomenon
team A new version Flink Homework , There are modifications in the old homework , Make the final verification findings before publishing ,Fliink There is backpressure in operation , Some operators report red , see topic The consumer group has lag
analysis
The phenomenon at that time is similar to the following figure , The last dot shows busy max 100%
guess 1
Data skew
The degree of parallelism is 3, Look at each task The amount of data processed is relatively uniform
guess 2
It takes a long time to call the external interface
Use arthas trace Interface discovery takes time 20ms about
guess 3
taskmanager Nodes are frequent GC , Cause a pause
see task node GC The frequency and time consumption are normal
guess 4, Confirm code changes
Confirm that the code changes very little ? It shouldn't be a code problem
reflection
A few hatchets come down , I still don't see the problem
Big recruit ( Flame chart )
Adjust configuration , Open the flame diagram
rest.flamegraph.enabled : true
On-cpu
see On-cpu The flame diagram is similar to the following 
off-cpu chart

analysis
There is no lock related , So don't think about off-cpu
from on-cpu Look at , It shows that most of the homework cpu They're all carrying out socket Code
I didn't pay attention here at that time , Later, I found that I shouldn't have much time to execute this code , As for why it can be adjusted socket , From top to bottom, it is because the program adjusts an external http Interface .
The frequency of normal logic interface should not be very high , It indicates that there is a problem with the code change , Confirm again that there is a problem with the code change , After repairing the code and going online again , The task is normal , either lag, Always solve .
Flame chart
Flame diagram example code
public class HotTest {
public static void main(String[] args) {
run();
}
private static void run() {
runA();
runB();
}
private static void runB() {
for (int i = 0; i < 300000; i++) {
System.out.println("this is b");
}
}
public static void runA() {
runC();
for (int i = 0; i < 500000; i++) {
System.out.println("this is a");
}
}
private static void runC() {
for (int i = 0; i < 200000; i++) {
System.out.println("this is c");
}
}
}
idea On the implementation 
Generate flame chart

How to see
y Depth of axis code function call
x The axis width represents the number of function samples , It can be simple and time-consuming
From the flame diagram
run Function takes time =runA()+runB()
runA Function takes time =runC()+ Print
So although this picture looks very complicated , When analyzing problems , Just look at the width of all the top-level functions , Then find it from top to bottom according to the widest function , Which business is executing this , Analysis is enough
Back to the beginning
Most of cpu They're all carrying out socket Code ,socket The code is caused by frequent interface calls , Finally, I found that there was a problem here, which led to .
summary
Flame diagram is used in analyzing performance scenarios , Confirmation is very convenient , We should strengthen our study in this field in the future .
边栏推荐
- 2万字带你从0到1搭建一套企业级微服务安全框架
- Children's programming electronic society graphical programming level examination scratch level 1 real problem analysis (multiple choice) June 2022
- 强网杯2021 pwn 赛题解析——baby_diary
- MySQL execution plan
- How to use Hyper-V in win10 Home Edition
- 『牛客|每日一题』逆波兰表达式
- Introduce you to JVM from architecture
- 20220725 自动控制原理中的卷积Convolution
- Vim中删除^M
- docker修改挂载到宿主机上的mysql配置文件不生效?
猜你喜欢

"Harmonyos" explore harmonyos applications

Queue assistant | product update log in June 2022

Click "Niuke | daily question" to eliminate it

"Niuke | daily question" inverse Polish expression

C # use log4net plug-in to output logs to files

AcWing-每日一题

『牛客|每日一题』模板栈

Can you learn fast and well with dual stream network? Harbin Institute of Technology & Microsoft proposed a distillation dual encoder model for visual language understanding, which can achieve fast an

Wechat applet - from entry to penetration

常用的cmd指令
随机推荐
[database] CTE (common table expression)
Summarize and learn STM32 to create project template
软考可以查成绩了,2022年上半年软考成绩查询入口已开通
如何删除语句审计日志?
UIToolkit中显示汉字
LeetCode刷题1:题目分类
QT listens for socket events and uses qsocketnotifier class
Database performance test (MySQL)
你了解MySQL都包含哪些“零件“吗?
vulnhub Lampião: 1
【无标题】转载
Proxyman, a native high-performance packet capturing tool, is for you who love learning
日志轮转logrotate
How to realize digital production mode in garment industry
C#使用log4net插件,输出日志到文件
Curve curvature display
Introduce you to JVM from architecture
“蔚来杯“2022牛客暑期多校训练营1补题记录(ACDGIJ)
What to pay attention to when using German chicks for the first time
SQL shell (PSQL) tool under PostgreSQL