apache / apache/dubbo

JVMUtil performance improvement

Open
#13,327 1 comment 0 reactions 0 assignees View on GitHub
component/sdk help wanted type/enhancement
Dominant language
Java
Stars
41.6k
Forks
26.4k
Avg merge
15h 13m
Merged PRs (30d)
4

Description

https://github.com/apache/dubbo/blob/3.0/dubbo-common/src/main/java/org/apache/dubbo/common/utils/JVMUtil.java

JVMUtil. jstack方法调用整体使用OutputStream作为输出可提升性能,而内部JVMUtil.getThreadDumpString使用String长字符串拼接反而降低了性能。
建议修改内部JVMUtil.getThreadDumpString方法同样为流式处理,减少字符串拼接的性能开销

同时,getThreadDumpString方法内部,可能还考虑性能影响,增加了栈深度控制(默认32)。
这个深度控制、对性能的提升,可能没有流式处理改造能带来的性能提升高。建议应先修改流式处理以提升性能。是否可经测试评估性能影响,取消栈深度控制。以便dubbo的threaddump能够使用在各类Thread分析工具中(如flamegraph.pl等)。

Contributor guide

Open the contributing guide

Research direction

Read dubbo-common/src/main/java/org/apache/dubbo/common/utils/JVMUtil.java, focusing on jstack and getThreadDumpString. Compare their output paths and measure the performance impact of stream-based handling and the current stack-depth limit. Done means the agreed performance behavior is implemented and thread-dump output remains usable by tools such as flamegraph.pl.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools, performance
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 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.