Skip to content

Avoid useless queue ops in ConcurrentLruCache.clear() - #37292

Merged
sbrannen merged 1 commit into
spring-projects:7.0.xfrom
guanchengang:perf
Sep 18, 2026
Merged

sbrannen merged 1 commit into
spring-projects:7.0.xfrom
guanchengang:perf

Conversation

@guanchengang

Copy link
Copy Markdown
Contributor

ConcurrentLruCache.clear() previously drained write operations before cleaning up the cache. This could re-enqueue nodes that clear() was about to remove, causing useless evictionQueue operations. Now clear() iterates the cache values directly, removes and marks nodes as removed first, and drains write operations afterward. Since AddTask fails silently after a node is marked removed, this avoids the no-op work and improves performance.

See gh-37287

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 18, 2026
@sbrannen sbrannen self-assigned this Sep 18, 2026
@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Sep 18, 2026
@sbrannen sbrannen added this to the 7.0.10 milestone Sep 18, 2026
ConcurrentLruCache.clear() previously drained write operations before
cleaning up the cache. This could re-enqueue nodes that clear() was
about to remove, causing useless evictionQueue operations. Now clear()
iterates the cache values directly, removes and marks nodes as removed
first, and drains write operations afterward. Since AddTask fails
silently after a node is marked removed, this avoids the no-op work
and improves performance.

See spring-projectsgh-37287

Closes spring-projectsgh-37292

Signed-off-by: Chengang Guan <guanchengang@qq.com>
@sbrannen
sbrannen changed the base branch from main to 7.0.x September 18, 2026 13:15
@sbrannen
sbrannen merged commit b49252e into spring-projects:7.0.x Sep 18, 2026
2 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Fixed via b49252e

@sbrannen

Copy link
Copy Markdown
Member

This has been merged into 7.0.x and main.

Thanks

@guanchengang
guanchengang deleted the perf branch September 19, 2026 00:15
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: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants