-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Memoized implementation for PathMatchingResourcePatternResolver [SPR-17344] #21878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Stéphane Nicoll commented That's interesting. Have you considered using the components index on this application? |
Rahul Shinde commented The index approach though I agree would have helped doesn't work for us at the moment. We have use-cases where |
Stéphane Nicoll commented It does work regardless of the modules you have. You just need to make sure to apply the indexer for every module that defines components. |
Rahul Shinde commented It is not really a limitation of the indexer but how each of the modules gets built and what information they have at build time. |
Stéphane Nicoll commented That's the wrong place to discuss this but it doesn't matter where |
Rahul Shinde commented Let me run and see if this is reproducible with the latest version. Will contact you offline. Thanks |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
Rahul Shinde opened SPR-17344 and commented
For applications that get bundled as an uber jar, while benchmarking the startup timings, it was found that there is always a fixed cost associated with every lookup that is performed by PathMatchingResourcePatternResolver (PMRPR) while component scanning.
This is a result of opening up the jar file and traversing the entries each time when PMRPR is used to find the resources.
With 10K+ beans and large number of packages for component-scanning, this adds up pretty quick.
After adding a Memoized implementation of the PathMatchingResourcePatternResolver, the refresh timings dropped around 2-4 minutes depending on the hardware spec.
The Memoized implementation builds a cache when a given jar is looked up the very first time. For subsequent lookups, it simply does a binary search over the cached entries.
This memoized implementation is attached to the ApplicationContext by overriding getResourcePatternResolver(..)
It would be good to have this as an option for applications that want to use a memoized version of PMRPR.
Affects: 5.0.9, 5.1 GA
Referenced from: pull request #1981
The text was updated successfully, but these errors were encountered: