惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - 意犹未尽

VsCode AI生态开源项目 掌握Redis集群通信,解决数据存取难题 jvm堆外内存-direct buffer spring-boot-actuator-Health原理 服务治理 - 意犹未尽 概念、架构、协议格式到裸协议实现,彻底搞懂 MCP 的本质 maven-antrun-plugin插件 Spring AI-MCP源码整理 java响应式编程基础 压测实践案例之网关 elasticseach-分页搜索 sentinel增加ip来源限流后占用服务高内存问题分析 spring-boot-actuator - 意犹未尽 elasticseach-head插件安装及使用 设计模式之美学习-代码命名规范 ES-Client-api-easy es sentinel-ProcessorSlot sentinel-SPI初始化时机 设计思路之系统做深能力的思维方式
记录一次内存泄漏排查
意犹未尽 · 2024-10-21 · via 博客园 - 意犹未尽

事件描述

order服务出现频繁GC告警,app卡顿

事件回顾

【2024-10-21 08:20:04】order出现频繁GC告警

【2024-10-21 09:24:04】通过命令jmap -histo:live [pid]查看存活对象发现sentinel统计对象占用大量内存

【2024-10-21 10:33:04】dump下堆内存信息

【2024-10-21 10:35:04】版本由2.7.0回退到2.4.0并通知到流控群。

事件回顾(排查分析)

【2024-10-11 15:57:00】根据dump的堆内存信息排查top5对象

查询引用发现LongAdder最终被ClusterNode的originCountMap引用,并且这个map存储很多元素

结合OQL进行针对性搜索ClusterNode并查看属性值。发现很多此类大对象

结合官方文档查看ClusterNode是干嘛

结合源码查看

com.alibaba.csp.sentinel.node.ClusterNode#getOrCreateOriginNode

最终导致服务内存得不到释放,频繁FullGC 导致用户卡顿

结论

sentinel二期增加了来源限流,支持根据客户端ip进行拉黑和限流.使用alibaba Adapter做扩展

com.alibaba.csp.sentinel.adapter.spring.webmvc.AbstractSentinelInterceptor#preHandle

com.yxt.starter.sentinel.spring.web.YxtCustomRequestOriginParser#getOrigin

因为直接面向用户的接口,前端存在轮询接口,用户手机网络ip随着位置移动基站变更,资源随着客户端ip变更和大量用户访问导致资源的计数器持续累加并且得不到释放。

事件影响

所有app用户使用app卡顿。

改进措施

针对来源限流,应先判断此接口是否有配置限流和黑白名单规则,并且这个客户端ip是否配置了限流和黑名单规则,如果未配置则不进行来源访问的统计

判断规则是否存在