alibaba / alibaba/Sentinel

对象创建太多导致频繁ygc

Open
#1,953 0 comments 0 reactions 0 assignees View on GitHub
area/performance
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

## Issue Description

Type: *bug report*

### Describe what happened (or what feature you want)
本地简单的run一个限流,代码如下:
`
while(true){
Entry entry = null;
try {
entry = SphU.entry("hello", 1);
} catch (BlockException e) {
} finally {
if (entry != null) {
entry.close();
}
}
}`

频繁gc,jprofiler观察mem排名靠前的对象都是sentinel整出来的
![image](https://user-images.githubusercontent.com/12962780/103864245-391bc000-50fd-11eb-9421-6e5c90424626.png)
![image](https://user-images.githubusercontent.com/12962780/103864428-8730c380-50fd-11eb-9f6e-dfa0e35fb016.png)

### Describe what you expected to happen

### How to reproduce it (as minimally and precisely as possible)

1.
2.
3.

### Tell us your environment

### Anything else we need to know?

Contributor guide

Open the contributing guide

Research direction

Start with the reported loop around SphU.entry("hello", 1) and reproduce the frequent young-generation garbage collections under profiling. Inspect which Sentinel objects are allocated on each iteration and compare the allocation profile with the entry lifecycle shown in the report. Done should mean identifying and addressing the excessive allocation, with profiling evidence showing reduced GC pressure.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.