[type:optimize] Optimize BodyParamUtils with Caffeine cache #5905
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true
.Description (英文)
This PR addresses the performance issue observed in the
isBaseType
method. During performance testing with theshenyu-examples-apache-dubbo-service
project, using thedubbo/insert
API on a Linux environment (8 CPU, 32GB memory), theisBaseType
method was identified as a bottleneck through flame graph analysis.By introducing a caching mechanism to
isBaseType
, the TPS (transactions per second) significantly improved from ~1500 to ~18000 during testing withab
. This optimization greatly enhances system performance for scenarios involving frequent type checks.Description (中文)
本 PR 优化了
isBaseType
方法的性能问题。通过火焰图分析,在使用shenyu-examples-apache-dubbo-service
项目对dubbo/insert
接口进行性能测试时(Linux 环境,8 核 CPU,32GB 内存),发现isBaseType
方法存在性能瓶颈。为
isBaseType
增加缓存机制后,在使用ab
工具进行测试时,TPS 从约 1500 提升至约 18000。这一优化大幅提升了频繁类型检查场景下的系统性能。ab 命令:
ab -c 300 -n 10000 -T application/json -p body.json http://localhost:9195/dubbo/insert
Changes (变更内容)
isBaseType
method to reduce redundant computations.Test Cases (测试情况)
shenyu-examples-apache-dubbo-service
andab
tool, confirming the performance improvement.Impact (影响范围)