Restore local grain directory lookup fast path#10126
Merged
ReubenBond merged 1 commit intoMay 26, 2026
Merged
Conversation
268d984 to
8479e84
Compare
8479e84 to
9aa2e19
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Restores a synchronous “local-owner” lookup fast path for the built-in DHT grain directory by letting the DHT locator consult the local directory’s authoritative partition on cache miss, avoiding unnecessary placement work queuing when this silo owns the directory partition.
Changes:
- Added
ILocalGrainDirectory.TryLocalLookup(...)and implemented it inLocalGrainDirectoryto check cache first, then the authoritative local partition when this silo is the partition owner. - Updated
DhtGrainLocator.TryLookupInCache(...)to delegate to the new local fast-path method. - Added a unit test validating that
TryLocalLookupfinds a local-partition entry after an explicit cache invalidation.
Show a summary per file
| File | Description |
|---|---|
| test/Orleans.Core.Tests/Directory/MockLocalGrainDirectory.cs | Updates test mock to implement the new TryLocalLookup API. |
| test/Orleans.Core.Tests/Directory/CachedGrainLocatorTests.cs | Adds coverage for LocalGrainDirectory.TryLocalLookup behavior on cache miss with local partition ownership. |
| src/Orleans.Runtime/GrainDirectory/LocalGrainDirectory.cs | Implements the local-owner synchronous lookup fast path with appropriate metrics. |
| src/Orleans.Runtime/GrainDirectory/ILocalGrainDirectory.cs | Adds TryLocalLookup to the local directory internal interface. |
| src/Orleans.Runtime/GrainDirectory/DhtGrainLocator.cs | Routes synchronous lookup to TryLocalLookup to enable the restored fast path. |
| src/Orleans.Core/GrainDirectory/IGrainLocator.cs | Clarifies TryLookupInCache contract/documentation as “no async work” (cache and/or authoritative local partition). |
Copilot's findings
- Files reviewed: 6/6 changed files
- Comments generated: 0
Use the DHT local grain directory to resolve cache misses from this silo's authoritative directory partition before queueing placement work. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9aa2e19 to
b397730
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reason
The grain directory metrics PR should stay focused on metric wiring and cleanup. The local lookup fast path restoration is a related but separate runtime behavior change, so it is split into this follow-up PR.
This PR is stacked on #10124. Until #10124 merges, GitHub may show the lower-stack metrics commits in the diff; the incremental change is the
Restore local directory lookup fast pathcommit.Solution
Restore a DHT fast path for cache-miss-heavy local-owner cases. The DHT locator now delegates its synchronous lookup path to the local grain directory, which checks the cache first and then, when this silo owns the grain's directory partition, reads the authoritative local partition before queueing placement work.
This keeps custom/pluggable grain directory behavior cache-only while allowing the built-in DHT directory to avoid unnecessary placement worker queuing for local partition hits.
Microsoft Reviewers: Open in CodeFlow