Skip to content
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

ConcurrentLruCache implementation is using too much heap memory #29520

Closed
bclozel opened this issue Nov 18, 2022 · 0 comments
Closed

ConcurrentLruCache implementation is using too much heap memory #29520

bclozel opened this issue Nov 18, 2022 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@bclozel
Copy link
Member

bclozel commented Nov 18, 2022

As seen in FasterXML/jackson-databind#3665, the approach taken in our ConcurrentLruCache implementation can result in an increase of memory heap consumption because of how the read operations queue is structured.

We've experimented with an alternate solution that "flattens" that queue, trading arrays of AtomicReference for AtomicReferenceArray. This results in a slight performance decrease but looks acceptable for our use case. We can also consider decreasing the default size of queues as well. They're currently calculated with "number of CPUs x fixed size" - the use cases present in Spring Framework probably don't need this much memory by default.

@bclozel bclozel added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) labels Nov 18, 2022
@bclozel bclozel added this to the 6.0.1 milestone Nov 18, 2022
@bclozel bclozel self-assigned this Nov 18, 2022
@bclozel bclozel modified the milestones: 6.0.1, 6.0.2 Nov 21, 2022
@jhoeller jhoeller modified the milestones: 6.0.2, 6.0.3 Nov 24, 2022
@bclozel bclozel changed the title Improve heap consumption in ConcurrentLruCache implementation ConcurrentLruCache implementation is using too much heap memory Nov 25, 2022
@bclozel bclozel closed this as completed in 4a555aa Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants