alibaba / alibaba/Sentinel

提供maxContextNameSize设置选项,对于超出限量的资源优先清理空闲

Open
#2,108 0 comments 0 reactions 0 assignees View on GitHub
good first issue kind/enhancement
Dominant language
Java
Stars
23.1k
Forks
8.1k
PR merge metrics
No merged PRs in 30d

Description

EntranceNode和DefaultNode构建的invocation tree 会一直存在内存中,因此如果资源大于默认2000,将无法再进行限流。

这一块虽然没有那么重要,但是可以采用这种优化
* 当数额未超过MAX_CONTEXT_NAME_SIZE,正常处理
* 当数额超过MAX_CONTEXT_NAME_SIZE,清理 intervalInMs 内无记录的node让出空间。

另外MAX_CONTEXT_NAME_SIZE也可以考虑提供出来供使用者调节。

这样处理在正常情况下应该对性能不会有什么影响,因为一般没有那么多资源限流。而如果真正遇到了需要限流的资源太多,也能够进行处理,而不是直接报错。不过那种场景可能会导致频繁new EntranceNode。而这也可以通过调节MAX_CONTEXT_NAME_SIZE来达到平衡。

_Originally posted by @zidoshare in https://github.com/alibaba/Sentinel/discussions/2097#discussioncomment-551580_

Contributor guide

Open the contributing guide

Research direction

Start with EntranceNode and DefaultNode, focusing on how the invocation tree is retained and how MAX_CONTEXT_NAME_SIZE and intervalInMs are used. Define the configurable limit and idle-node cleanup behavior, then verify that resources beyond the limit are handled without the existing failure while normal processing remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.