apache / apache/servicecomb-java-chassis
自定义Filter存在未知的耗时
- Dominant language
- Java
- Stars
- 1.9k
- Forks
- 814
- Avg merge
- 8d 23h
- Merged PRs (30d)
- 1
Description
问题:环境上发现server filters request存在夸张的耗时

定位:使用arthas的trace命令抓取某一个的filter耗时,发现耗时会存在不同的地方,比如new 对象、普通对象的set方法,或者方法调用
1)
+---[99.94% 177.84957ms ] xxx:authenticate()
| `---[0.04% 0.071806ms ] xxx:authenticate()
| +---[1.02% 7.31E-4ms ] xxx:getContext()
2)
| +---[99.99% 245.681214ms ] xxx:parseToken()
| | `---[100.00% 245.676919ms ] xxx:parseToken()
| | +---[0.00% 6.23E-4ms ] java.util.Map:get()
| | +---[99.97% 245.595983ms ] xxx.CommonMetadata:()
3)
| | +---[37.90% 11.693914ms ] java.lang.Math:abs()
4)
+---[99.80% 47.11804ms ] xxx:applyTimestamp()
规律:高并发场景下,CPU增高,基本上会导致Filter执行有额外的耗时。
请问下像这种执行耗时问题有什么好的定位方法吗?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the reported server-filter request path and reproduce it under high concurrency while recording CPU and Arthas trace output. Compare the examples around authenticate, parseToken, CommonMetadata construction, Math.abs, and applyTimestamp; done means identifying the source of the extra latency and documenting a concrete diagnostic conclusion.
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