You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Optimize in-memory job acquisition and queries - #232
Fair acquisition repeatedly scans the entire job store and rebuilds eligible groups for every claim. Build ordered group backlogs and active counts once per queue acquisition, then advance the selected group and update active counts and round-robin sequences after each claim. Cache definition eligibility within the locked acquisition and invalidate it after each successful claim so rate and concurrency limits remain enforced.
Use dictionary lookup for exact job handles, apply query filters and paging before copying records, and count monitoring states in one pass. Add six regression cases covering exhausted definition limits and request capacities across groups, noisy-group reclassification within a batch, and exact-handle filters with updated queue metadata.
Performance
Local Release microbenchmark on .NET 10.0.13, compiled with SDK 11.0.100-preview.7.26381.103. Medians of 11 measurements after three warmups, excluding setup, disposal, and explicit GC. Each measurement uses a fresh store containing 50,000 jobs: 5,000 due pending jobs and 45,000 succeeded jobs, split across two definitions and 20 groups in one queue. Acquisition batch size is 64; filtered paging returns 25 pending jobs of one definition after skipping 100. Results are workload-specific and do not measure contention.
Operation
Before
After
Fair acquisition of 64 jobs
256.65 ms
7.01 ms
Filtered page query
7.05 ms
1.51 ms
Monitoring snapshot
7.06 ms
3.91 ms
Ordinary acquisition of 64 jobs
3.49 ms
3.49 ms
Fair acquisition allocations decrease from 144,109,704 to 569,656 bytes (99.6% reduction).
Validation
Shared project Release builds pass for net8.0, net10.0, and net11.0.
All 98 in-memory storage conformance and regression tests pass on .NET 10.
All 92 CapturingJobStorage conformance cases pass on .NET 10.
git diff --check passes.
Summary by CodeRabbit
Performance
Job acquisition and monitoring queries now process in-memory job data more efficiently.
Bug Fixes
Fair job acquisition now advances past definitions that have no available capacity and updates group selection after each claim.
Job queries now combine filters consistently and report a job’s current queue after its definition changes.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
📝 Walkthrough
The in-memory job storage acquisition, monitoring, and query paths now reduce repeated eligibility checks, scans, or record conversions. Regression tests cover acquisition ordering under capacity limits and query filtering after a job definition’s queue changes.
Acquisition paths cache eligibility checks. Fair acquisition uses per-group backlogs and tracks active jobs as it selects jobs. Tests cover capacity limits, group ordering, and acquisition helpers.
Monitoring and job queries src/Immediate.Jobs.Shared/Storage/InMemoryJobStorage.Query.cs, tests/Immediate.Jobs.StorageTests/InMemoryStoragePerformanceRegressionTests.cs
Monitoring counts job states in one pass. Query methods filter stored records before converting results. Tests check combined filters and the current queue after a job definition changes.
The acquisition and query changes have no identified issue requiring resolution before merge; normal build and test checks still apply.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 3 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title clearly and concisely summarizes the main changes to in-memory job acquisition and query paths.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
Commit to this branch
Create a new PR
🧪 Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
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
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.
Fair acquisition repeatedly scans the entire job store and rebuilds eligible groups for every claim. Build ordered group backlogs and active counts once per queue acquisition, then advance the selected group and update active counts and round-robin sequences after each claim. Cache definition eligibility within the locked acquisition and invalidate it after each successful claim so rate and concurrency limits remain enforced.
Use dictionary lookup for exact job handles, apply query filters and paging before copying records, and count monitoring states in one pass. Add six regression cases covering exhausted definition limits and request capacities across groups, noisy-group reclassification within a batch, and exact-handle filters with updated queue metadata.
Performance
Local Release microbenchmark on .NET 10.0.13, compiled with SDK 11.0.100-preview.7.26381.103. Medians of 11 measurements after three warmups, excluding setup, disposal, and explicit GC. Each measurement uses a fresh store containing 50,000 jobs: 5,000 due pending jobs and 45,000 succeeded jobs, split across two definitions and 20 groups in one queue. Acquisition batch size is 64; filtered paging returns 25 pending jobs of one definition after skipping 100. Results are workload-specific and do not measure contention.
Fair acquisition allocations decrease from 144,109,704 to 569,656 bytes (99.6% reduction).
Validation
net8.0,net10.0, andnet11.0.CapturingJobStorageconformance cases pass on .NET 10.git diff --checkpasses.Summary by CodeRabbit