g0ne150 opened a new pull request, #5905:
URL: https://github.com/apache/shenyu/pull/5905

   - Added Caffeine cache for base type checking
   - Improved isBaseType() performance with 5000-entry cache
   - Reduced class loading overhead
   
   <!-- Describe your PR here; e.g. Fixes #issueNo -->
   
   <!--
   Thank you for proposing a pull request. This template will guide you through 
the essential steps necessary for a pull request.
   -->
   Make sure that:
   
   - [x] You have read the [contribution 
guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [x] You submit test cases (unit or integration tests) that back your 
changes.
   - [x] Your local test passed `./mvnw clean install 
-Dmaven.javadoc.skip=true`.
   
   
![image](https://github.com/user-attachments/assets/842cb2f7-30be-49d3-888d-6b0372ab420f)
   
   ### Description (英文)
   This PR addresses the performance issue observed in the `isBaseType` method. 
During performance testing with the `shenyu-examples-apache-dubbo-service` 
project, using the `dubbo/insert` API on a Linux environment (8 CPU, 32GB 
memory), the `isBaseType` 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 with 
`ab`. 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。这一优化大幅提升了频繁类型检查场景下的系统性能。  
   
   
![image](https://github.com/user-attachments/assets/1cbe7ead-880e-46dd-9b10-a69a405b09dd)
   
   
   ### Changes (变更内容)
   1. Add a caching mechanism to the `isBaseType` method to reduce redundant 
computations.  
   
   ### Test Cases (测试情况)
   - Conducted performance tests using `shenyu-examples-apache-dubbo-service` 
and `ab` tool, confirming the performance improvement.  
   
   ### Impact (影响范围)
   - **Performance**: Significant TPS improvement in scenarios involving 
frequent type checks.  
   - **Compatibility**: No breaking changes; the caching mechanism is 
seamlessly integrated.  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@shenyu.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to