Repository navigation
feat(streaming): configure memory stream dequeue limits - #11238
Merged
ReubenBond merged 1 commit intoSep 10, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The change is narrowly scoped, preserves existing defaults/constructors, adds validation, updates docs, and includes targeted tests for configuration flow and dequeue bounds.
Review tier: Lite
Findings: None
What changed in this PR
This PR adds a per-provider configuration knob for Orleans memory streams to limit the number of queue records requested per dequeue, helping applications avoid oversized dequeue responses (and associated message-body limit failures) while allowing tuning of throughput vs call overhead.
Changes:
- Introduces
MemoryStreamCacheOptions.MaxAddCount(default100) with named options + startup validation. - Plumbs
MaxAddCountthroughMemoryAdapterFactoryintoMemoryPooledCacheandIQueueFlowController.GetMaxAddCount(). - Adds docs and test coverage for defaults, configuration, validation, named-provider isolation, and constructor compatibility, plus regenerated public API.
| File | Description |
|---|---|
| test/Orleans.Streaming.Tests/OrleansRuntime/Streams/MemoryStreamCacheOptionsTests.cs | Adds tests covering default behavior, configuration flow, validation, and dequeue bounds. |
| src/Orleans.Streaming/MemoryStreams/MemoryStreamProviderBuilder.cs | Binds named provider configuration sections to MemoryStreamCacheOptions for config-based registration. |
| src/Orleans.Streaming/MemoryStreams/MemoryStreamCacheOptions.cs | Adds new options type with documented semantics and default value. |
| src/Orleans.Streaming/MemoryStreams/MemoryStreamBuilder.cs | Adds ConfigureCache extension and startup validation/logging for the new named options. |
| src/Orleans.Streaming/MemoryStreams/MemoryPooledCache.cs | Stores configured max-add count and exposes it via GetMaxAddCount(); preserves existing constructor behavior. |
| src/Orleans.Streaming/MemoryStreams/MemoryAdapterFactory.cs | Reads MemoryStreamCacheOptions by provider name and passes the configured limit into the cache. |
| src/api/Orleans.Streaming/Orleans.Streaming.cs | Updates generated public API surface for the new options and overloads. |
| docs/site/src/content/docs/streaming/streaming-operations.md | Documents the new tuning option and the throughput vs response-size tradeoff. |
| docs/site/src/content/docs/streaming/stream-providers.md | Links to the tuning guidance from the memory streams provider docs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This was referenced Oct 3, 2026
8 tasks
This was referenced Oct 5, 2026
Closed
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.
Problem
Memory streams request a fixed 100 queue records per dequeue. Combining large records into one queue-grain response can exceed the configured message-body limit after those records have been removed from the queue. Applications need a per-provider record limit to tune response sizes and queue-call overhead.
Solution
Add named
MemoryStreamCacheOptions.MaxAddCount, defaulting to 100, with positive-value validation at startup. Configure it throughConfigureCacheon the silo memory-stream configurator or through the named provider's configuration section.Pass the configured count from
MemoryAdapterFactoryintoMemoryPooledCacheand expose it throughIQueueFlowController.GetMaxAddCount(). Preserve the existing cache constructor and its default behavior, and add an overload for direct cache construction.Document the throughput/response-size tradeoff and the record-count semantics: aggregate response bytes depend on serialized record payloads. Include coverage for defaults, custom values, named-provider isolation, validation, configuration binding, receiver dequeue bounds, and constructor compatibility, plus the regenerated public API surface.
Microsoft Reviewers: Open in CodeFlow