[Documentation] Cosmos: Optimization Plan for PPCB High Memory Utilization#4419
Merged
kundadebdatta merged 4 commits intoMay 18, 2026
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a comprehensive DHAT-based report documenting the PPCB routing-state memory footprint in azure_data_cosmos_driver, including methodology, measured results, and validation of an already-shipped v2 optimization.
Changes:
- New performance/memory analysis document covering PPCB steady-state heap usage and scaling projections
- Documents measurement methodology + reproduction steps (synth harness and real-account validation)
- Captures before/after results for v2 (
SmallVec+CompactString) and operational implications
…datta/4361_ppcb_memory_optimization_plan_temp
05e6862
into
release/azure_data_cosmos-previews
12 checks passed
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.
What this PR does
Documentation-only port. Adds a single new file:
sdk/cosmos/azure_data_cosmos_benchmarks/docs/PPCB_MEMORY_ANALYSIS.md(+1,571 lines)No source, manifest, test, or CI changes. No behavioral impact on any shipped crate.
Why
The Per-Partition Circuit Breaker (PPCB) subsystem in
azure_data_cosmos_drivercarries lazy routing state whose worst-case footprint scales withpartition_count × failed_regions_per_partition. Large-container customers (~80k physical partitions) have asked us for concrete memory-cost guidance. This document is the consolidated answer, captured underazure_data_cosmos_benchmarks/docsso it lives next to the harness that produced the numbers.It also documents an already-applied v2 optimization (
SmallVec<[CosmosEndpoint; 4]>with theunionfeature replacingHashSet<CosmosEndpoint>, plusCompactStringforPartitionKeyRangeId) and validates it against both a synthesized harness and a real Cosmos DB INT account.Document structure
Headline numbers documented
v1 (HashSet-based) at 80k partitions, fully tripped, 2 failed regions/partition:
v2 (
SmallVec+CompactString) impact:HashMapbacking allocation, reducing fragmentation risk.PartitionFailoverEntryshrank 8 B (unexpected secondary win fromSmallVec'sunionfeature reusing the discriminant niche).Reviewer guidance
Cargo.toml,src/,tests/, or CI.SmallVec+CompactString) are already shipped onrelease/azure_data_cosmos-previews(see PR Slim PartitionKeyRange cache #4393 Slim PartitionKeyRange cache in the immediate history) — this PR only adds the report that motivated and validated them.Validation
git statusclean after commit (only pre-existing untrackedsdk/cosmos/.vscode/remains, untouched).origin/release/azure_data_cosmos-previews(962c1f7b7).docs/folder).Out of scope
SmallVec+CompactString(e.g., §11.3 boxing the HashMap value is explicitly deferred).