Comments (3)
Some more analysis breaks the 200ms down as follows (it includes transaction annotation processing as well):
50ms: pointcut processing for `@Cacheable`
50ms: pointcut processing for `@Transactional`
70ms: JCache (implementation from EhCache)
30ms: Spring Boot "overhead"
The pointcut processing could maybe be optimized away using an index of some sort - it is all about checking all the methods of all the beans for annotations, and 99% of the time there was no point even looking.
The cache initialization is native to JCache (or EhCache) but it can probably be deferred somehow, e.g. till the first time the cache is used.
The rest is mysterious. Best guess so far is that it is the sheer number of cache provider configurations that have to be processed (there are 10). There are some suspicious sources of possible slowness in there (like a linear search for a provider in a map), but none of them seem to account for the whole 30ms.
from spring-init.
A different experiment, slight more granular breakdown:
CacheBenchmarkIT.bench annotation empty avgt 10 0.308 ± 0.009 s/op
CacheBenchmarkIT.bench annotation simple avgt 10 0.386 ± 0.008 s/op
CacheBenchmarkIT.bench annotation cache avgt 10 0.403 ± 0.010 s/op
CacheBenchmarkIT.bench annotation jcache avgt 10 0.529 ± 0.043 s/op
CacheBenchmarkIT.bench annotation manual avgt 10 0.368 ± 0.012 s/op
which translates to
60ms: pointcut processing = "manual" - "empty"
20ms: Spring Boot overhead - conditions, and import selection = "simple" - "manual"
10ms: beans added by Spring Framework to support JSR107 = "cache" - "simple"
120ms: JCache (actually EhCache) = "jcache" - "cache"
The "empty" sample has no caching. The "simple" sample is Spring Boot without JSR107 and manually selecting the cache type. The "cache" sample is the same, but with JSR107 on the classpath so Spring Framework adds some extra features. The "jcache" sample has EhCache as well and Spring Boot selects the cache provider.
There are no @Cacheable
methods anywhere in the app (so all of the >200ms could be saved in principle).
from spring-init.
See https://jira.spring.io/browse/SPR-17646
from spring-init.
Related Issues (20)
- Reflection-free binding to @ConfigurationProperties HOT 1
- Support for native-image.properties as generated resource HOT 1
- Fix \\\n issue in native-image.properties (Java 8 only?)
- Support for functional variants of /info and /health HOT 1
- Make functional actuators work in a native image HOT 1
- Avoid XmlInitializer to increase the size of native images HOT 2
- Automate reflection configuration for native image actuator endpoints
- Allow to remove XmlInitializer substitution HOT 4
- Support proxy-less @Configuration classes unchanged from a developer POV HOT 3
- Support for @Bean(name="foo")
- Support for autowiring multiple beans with the same type but different generics
- Provide a non-reflective version of AutowiredAnnotationBeanPostProcessor
- Ignore @RequestMapping related beans with functional web apps HOT 1
- @WebFluxTest not working for functional app HOT 1
- closedWorld=false not working with native-image because InitializerLocator fails
- Support for non-primitiveish types in custom binders HOT 1
- @ConfigurationProperties on @Bean methods still requires reflection
- Upgrade to Spring Boot 2.4.0.RC1
- Gradle support HOT 3
- Support for package-private @Components in the GeneratedTypeService
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-init.