[AI-8th] perf: add reflection cache#1415
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1415 +/- ##
============================================
+ Coverage 82.94% 83.06% +0.12%
- Complexity 2975 3018 +43
============================================
Files 340 345 +5
Lines 9833 10040 +207
Branches 1178 1200 +22
============================================
+ Hits 8156 8340 +184
- Misses 1163 1171 +8
- Partials 514 529 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a reusable ReflectionCache facility to reduce repeated reflection lookups across SOFABoot, wires it into key components (health readiness + datasource tracer), and exposes cache stats/clear via a new actuator endpoint.
Changes:
- Add core
ReflectionCacheimplementation with hit/miss statistics and clear support - Auto-configure the cache via
sofa.boot.reflection.cache.enabledand integrate it into readiness health + datasource processing - Add
reflection-cacheactuator endpoint plus unit tests and smoke/integration tests
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| sofa-boot-tests/sofa-boot-smoke-tests/sofa-boot-smoke-tests-actuator/src/test/java/com/alipay/sofa/smoke/tests/actuator/reflection/ReflectionCacheEndpointWebTests.java | Smoke test coverage for the new actuator endpoint over HTTP |
| sofa-boot-project/sofa-boot/src/test/java/com/alipay/sofa/boot/reflection/ReflectionCacheTests.java | Unit tests validating cache hit/miss behavior, miss caching, and disabled mode |
| sofa-boot-project/sofa-boot/src/main/java/com/alipay/sofa/boot/reflection/ReflectionCache.java | New reflection lookup cache implementation + stats/clear |
| sofa-boot-project/sofa-boot/src/main/java/com/alipay/sofa/boot/constant/SofaBootConstants.java | Adds reflection-cache to the default web exposure list |
| sofa-boot-project/sofa-boot-core/tracer-sofa-boot/src/main/java/com/alipay/sofa/boot/tracer/datasource/DataSourceBeanPostProcessor.java | Uses cached method lookup when available |
| sofa-boot-project/sofa-boot-autoconfigure/src/test/java/com/alipay/sofa/boot/autoconfigure/tracer/datasource/DataSourceAutoConfigurationTests.java | Ensures datasource auto-config runs with reflection-cache auto-config present |
| sofa-boot-project/sofa-boot-autoconfigure/src/test/java/com/alipay/sofa/boot/autoconfigure/reflection/ReflectionCacheAutoConfigurationTests.java | Tests for reflection-cache auto-configuration and property toggle |
| sofa-boot-project/sofa-boot-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports | Registers ReflectionCacheAutoConfiguration for Boot auto-import |
| sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/tracer/datasource/DataSourceAutoConfiguration.java | Injects ReflectionCache into DataSourceBeanPostProcessor |
| sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/reflection/ReflectionCacheProperties.java | Adds configuration properties for enabling/disabling caching |
| sofa-boot-project/sofa-boot-autoconfigure/src/main/java/com/alipay/sofa/boot/autoconfigure/reflection/ReflectionCacheAutoConfiguration.java | Creates/configures the ReflectionCache bean |
| sofa-boot-project/sofa-boot-actuator/src/test/java/com/alipay/sofa/boot/actuator/reflection/ReflectionCacheEndpointTests.java | Unit tests for endpoint stats + clear behavior |
| sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/reflection/ReflectionCacheEndpoint.java | New reflection-cache actuator endpoint (stats + clear) |
| sofa-boot-project/sofa-boot-actuator/src/main/java/com/alipay/sofa/boot/actuator/health/HealthIndicatorProcessor.java | Uses cached Class.forName for excluded indicator class loading |
| sofa-boot-project/sofa-boot-actuator-autoconfigure/src/test/java/com/alipay/sofa/boot/actuator/autoconfigure/rpc/RpcActuatorAutoConfigurationTests.java | Test wiring updated to include reflection-cache auto-config |
| sofa-boot-project/sofa-boot-actuator-autoconfigure/src/test/java/com/alipay/sofa/boot/actuator/autoconfigure/reflection/ReflectionCacheEndpointAutoConfigurationTests.java | Tests conditional creation of the new endpoint auto-config |
| sofa-boot-project/sofa-boot-actuator-autoconfigure/src/test/java/com/alipay/sofa/boot/actuator/autoconfigure/health/ReadinessEndpointAutoConfigurationTests.java | Test wiring updated to include reflection-cache auto-config |
| sofa-boot-project/sofa-boot-actuator-autoconfigure/src/test/java/com/alipay/sofa/boot/actuator/autoconfigure/health/ReadinessAutoConfigurationTests.java | Test wiring updated to include reflection-cache auto-config |
| sofa-boot-project/sofa-boot-actuator-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports | Registers endpoint auto-config for Boot auto-import |
| sofa-boot-project/sofa-boot-actuator-autoconfigure/src/main/java/com/alipay/sofa/boot/actuator/autoconfigure/reflection/ReflectionCacheEndpointAutoConfiguration.java | Auto-configures the ReflectionCacheEndpoint when exposed/available |
| sofa-boot-project/sofa-boot-actuator-autoconfigure/src/main/java/com/alipay/sofa/boot/actuator/autoconfigure/health/ReadinessAutoConfiguration.java | Injects ReflectionCache into HealthIndicatorProcessor bean setup |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@kuleat, please handle the Copilot's comments first. |
#1409
Changes
ReflectionCacheto cache repeated reflection lookupssofa.boot.reflection.cache.enabledHealthIndicatorProcessorandDataSourceBeanPostProcessorreflection-cacheactuator endpoint for stats and clear operation