Skip to content

Conversation

zml1206
Copy link
Contributor

@zml1206 zml1206 commented Oct 17, 2025

What changes were proposed in this pull request?

Continue #52210.
Introduced three concurrent hash maps to track block ID associations for optimize BlockManager remove operations by introducing cached mappings to eliminate O(n) linear scans.

Why are the changes needed?

Previously, removeRdd(), removeBroadcast(), and removeCache() required scanning all blocks in blockInfoManager.entries to find matches. This approach becomes a serious bottleneck when:

  1. Large block counts: In production deployments with millions or even tens of millions of cached blocks, linear scans can be prohibitively slow
  2. High cleanup frequency: Workloads that repeatedly create and discard RDDs or broadcast variables accumulate overhead quickly

The original removeRdd() method already contained a TODO noting that an additional mapping would be needed to avoid linear scans. This PR implements that improvement.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Existing tests BlockManagerSuite ensure that blockId is used and cleaned up normally.

Was this patch authored or co-authored using generative AI tooling?

No.

@zml1206
Copy link
Contributor Author

zml1206 commented Oct 17, 2025

Different from #52210, the cache mapping is moved to BlockInfoManager, and write/remove synchronously with blockInfoWrappers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant