基于ConcurrentLinkedHashMap实现的CacheMap会导致在高CPU核数下,单个接口产生的ParameterMetric对象很大的问题
- Dominant language
- Java
- Stars
- 23.1k
- Forks
- 8.1k
- PR merge metrics
- No merged PRs in 30d
Description
## Issue Description
ConcurrentLinkedHashMap在构造二维数组时会根据CPU核心数来计算出当前数组的一维下标长度,当核数为96时,下标为128,此时单个ParameterMetric对象大小接近1M,如下图所示:

当接口调用量较大时,此处将会占用大量内存,sentinel是否有考虑过这块的内存使用,或者切成其他Cache?毕竟googlecode.concurrentlinkedhashmap作者也建议使用Caffeine了.
### Tell us your environment
springboot 2.3.10
sentinel 1.7.2
springcloudgateway 2.2.6
### Anything else we need to know?
sentinel在后续版本中是否有意向对这块进行修改?
Contributor guide
Research direction
Start by locating CacheMap and its ConcurrentLinkedHashMap usage, then inspect how ParameterMetric objects are created and retained under high CPU-core counts. The issue provides no file or test entry point; done would require an agreed cache design, a reproducible memory comparison, and regression coverage.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100