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
Limit size of context cache in the TestContext framework [SPR-8055] #12710
Comments
Gaetan Pitteloud commented Here is an implementation of the feature, that I have implemented and used in the meanwhile. Feel free to use it. |
Sam Brannen commented Since contexts are now cached using However, if someone feels that the fix for #12343 is insufficient, we may consider revisiting the proposal to explicitly limit the cache size at a later date. |
Sam Brannen commented As stated in the comments for issue #12343,
I am therefore reopening this issue in order to investigate a more robust solution. I have also added a Deliverables section to this issue's Description. |
Sam Brannen commented This issue now supersedes #12343. |
Gaetan Pitteloud commented The initially proposed patch is for Spring 3.2. In Spring 4, the ContextCache class is a bit different since the key of the cache is not a String anymore. I have attached the newest version. Further, the In order to prevent it, we first put a fake context in the cache (which may trigger a close of the oldest entry if the cache was full), then we load the context (
|
Gaetan Pitteloud commented Spring 4 ContextCache with a possible maximum size |
Sam Brannen commented The ongoing work for this issue can be viewed here: https://github.com/sbrannen/spring-framework/commits/SPR-8055 Currently, the only piece missing is automatic, transparent support for properly closing evicted contexts. |
Sam Brannen commented Completed as described in the comments for GitHub commit e18d5b5:
|
Gaetan Pitteloud opened SPR-8055 and commented
Overview
The cache of application contexts becomes too big when running a complete suite of tests that each load a full
ApplicationContext
with a JPAEntityManagerFactory
. There are situations where a tiny difference in the configuration forces us to load a different context.Since the context cache is only there for performance reasons, its maximum size should be configurable -- a system property might be the best choice, while no property means unbounded size -- so that the least recently used can be properly closed and evicted from the cache.
Deliverables
SpringProperties
.DefaultContextCache
to implement an LRU cache eviction algorithm.Attachments:
Issue Links:
Referenced from: commits e18d5b5, ebeba43
1 votes, 6 watchers
The text was updated successfully, but these errors were encountered: