Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Availability: Adds optimization to reduce metadata calls for addresses #3123

Merged
merged 2 commits into from
Apr 1, 2022

Conversation

j82w
Copy link
Contributor

@j82w j82w commented Mar 31, 2022

Pull Request Template

Description

If multiple requests are running it's possible that one request refreshes the cache.
Old:

sequenceDiagram
    participant Request1
    participant Request2
    Request1->>GatewayAddressCache: Force refresh partition key range 0
    GatewayAddressCache->>Cosmos Gateway: Get addresses for range 0
    Request2->>GatewayAddressCache: Get partition key range 0
    GatewayAddressCache->>Request2: Return [1,2,3,4]
    Cosmos Gateway->>GatewayAddressCache: Return [1,2,3,5]
    GatewayAddressCache->>Request1: Return [1,2,3,5]
    Request2->>GatewayAddressCache: Force refresh partition key range 0
    GatewayAddressCache->>Cosmos Gateway: Get addresses for range 0
    Cosmos Gateway->>GatewayAddressCache: Return [1,2,3,5]
    GatewayAddressCache->>Request2: Return [1,2,3,5]
Loading

New optimized:

sequenceDiagram
    participant Request1
    participant Request2
    Request1->>GatewayAddressCache: Force refresh partition key range 0
    GatewayAddressCache->>Cosmos Gateway: Get addresses for range 0
    Request2->>GatewayAddressCache: Get partition key range 0
    GatewayAddressCache->>Request2: Return [1,2,3,4]
    Cosmos Gateway->>GatewayAddressCache: Return [1,2,3,5]
    GatewayAddressCache->>Request1: Return [1,2,3,5]
    Request2->>GatewayAddressCache: Force refresh partition key range 0
    GatewayAddressCache->>Request2: Return [1,2,3,5]
Loading

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [] This change requires a documentation update

Closing issues

To automatically close an issue: closes #IssueNumber

Copy link
Member

@ealsur ealsur left a comment

Choose a reason for hiding this comment

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

Love the mermaid diagram!

Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

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

Nice description! Change LGTM

@j82w j82w merged commit ad2e47a into master Apr 1, 2022
@j82w j82w deleted the users/jawilley/ha/addressCacheAvoidRefresh branch April 1, 2022 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants