当前位置:网站首页>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 .
边栏推荐
- Ruby on rails Code Execution Vulnerability (cve-2020-8163) technical analysis, research, judgment and protection
- 7. Reverse integer integer
- How to realize digital production mode in garment industry
- SQL shell (PSQL) tool under PostgreSQL
- 问题:Can‘t download sh shellcheck. Please install it manually及shell脚本的一些命令使用
- 二叉树知识总结
- 强网杯2021 pwn 赛题解析——baby_diary
- Uitoolkit tool template project
- FastDFS-支持双IP、IPV6
- "Niuke | daily question" inverse Polish expression
猜你喜欢

CS5801_HDMI转EDP优势替代LT6711A方案

How does the national standard gb28181 protocol easygbs platform realize device video recording and set streaming IP?

vulnhub Lampião: 1

Valid bracket sequence of "Niuke | daily question"

Press in and pop-up sequence of "Niuke | daily question" stack

从Architecture带你认识JVM

『牛客|每日一题』 栈的压入、弹出序列

Integrated design of signal processing systems - Design of solver functions (continuous and discrete time systems)

Do you know what "parts" MySQL contains?

【硬十宝典】——7.2【动态RAM】DDR4与DDR3区别解析
随机推荐
"Niuke | daily question" template stack
数据库性能测试(mysql)
优炫数据库JDBC打开日志方式有哪些
Merge_sort
『牛客|每日一题』模板栈
解决 Chrome 浏览器被毒霸篡改问题
Exclusive lock
MySQL isolation level transactions
MySQL table write lock
[Star Project] small hat aircraft War (III)
Go language configuration vscade
20000 words will take you from 0 to 1 to build an enterprise level microservice security framework
mysql优化之索引及索引失效
Proxyman, a native high-performance packet capturing tool, is for you who love learning
SQL shell (PSQL) tool under PostgreSQL
Rectification ideas for the previous article
Ruby on rails Code Execution Vulnerability (cve-2020-8163) technical analysis, research, judgment and protection
日志轮转logrotate
[hard ten treasures] - 7.2 [dynamic RAM] analysis of the difference between DDR4 and DDR3
Experimental flags: --disable_ admission_ control=false --enable_ rm=false --llama_ callback_ port=28000