Skip to content

[Internal] PPAF: Adds Code to Enable Read Hedging By Default#5165

Merged
kirankumarkolli merged 17 commits intomasterfrom
users/kundadebdatta/5047_enable_read_hedging_with_ppaf
May 9, 2025
Merged

[Internal] PPAF: Adds Code to Enable Read Hedging By Default#5165
kirankumarkolli merged 17 commits intomasterfrom
users/kundadebdatta/5047_enable_read_hedging_with_ppaf

Conversation

@kundadebdatta
Copy link
Copy Markdown
Member

@kundadebdatta kundadebdatta commented May 2, 2025

Pull Request Template

Description

This PR does the following two things:

  • Enables Cross Regional Hedging by default with a threshold of either 1 second or half of the request timeout value provided, whichever is minimum, when PPAF is enabled. Note that the default availability strategy can be opted out by setting the AvailabilityStrategy to DisabledAvailabilityStrategy in the CosmosClientOptions. To understand this better, please take a look at the example below:

          CosmosClientOptions cosmosClientOptions = new CosmosClientOptions()
          {
              EnablePartitionLevelFailover = true,
              ConsistencyLevel = Cosmos.ConsistencyLevel.Strong,
              AvailabilityStrategy = new DisabledAvailabilityStrategy(),
          };
    
  • As of today, during the cosmos client initialization, with PPAF enabled we ensure that either the ApplicationRegion or ApplicationPreferredRegions is present through a validation. Since we now have established the concept of Effective Preferred Region, this PR removes the above mandatory validation on ApplicationRegion or ApplicationPreferredRegions, as in the if there are no preferred regions passed explicitly, the .NET SDK can populate the effective preferred regions.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Closing issues

To automatically close an issue: closes #5047, #5164

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good!

@kundadebdatta kundadebdatta changed the title [Internal] PPAF: Enable Read Hedging By Default [Internal] PPAF: Adds Code to Enable Read Hedging By Default May 2, 2025
Comment thread Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs Outdated
Comment thread Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs Outdated
Comment thread Microsoft.Azure.Cosmos/src/Routing/GlobalPartitionEndpointManagerCore.cs Outdated
Comment thread Microsoft.Azure.Cosmos/src/Util/ConfigurationManager.cs Outdated
@kundadebdatta kundadebdatta added the auto-merge Enables automation to merge PRs label May 7, 2025
Comment thread Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs Outdated
jeet1995
jeet1995 previously approved these changes May 7, 2025
Copy link
Copy Markdown
Member

@jeet1995 jeet1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - only ask from my side would be to double check how PPCB behaves with hedging on by default. In the Java SDK, we encountered a bug where PPCB doesn't kick in with hedging.

kirankumarkolli
kirankumarkolli previously approved these changes May 8, 2025
jeet1995
jeet1995 previously approved these changes May 8, 2025
@kundadebdatta kundadebdatta dismissed stale reviews from jeet1995 and kirankumarkolli via 331f57d May 8, 2025 02:04
jeet1995
jeet1995 previously approved these changes May 8, 2025
kirankumarkolli
kirankumarkolli previously approved these changes May 8, 2025
@kundadebdatta kundadebdatta dismissed stale reviews from kirankumarkolli and jeet1995 via a4cde1b May 8, 2025 18:00
@kirankumarkolli kirankumarkolli merged commit 6fca24b into master May 9, 2025
26 checks passed
@kirankumarkolli kirankumarkolli deleted the users/kundadebdatta/5047_enable_read_hedging_with_ppaf branch May 9, 2025 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-merge Enables automation to merge PRs PerPartitionAutomaticFailover

Projects

None yet

4 participants