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

[docs] Explain partition key #2343

Closed
lonix1 opened this issue Oct 13, 2024 · 2 comments · Fixed by #2344
Closed

[docs] Explain partition key #2343

lonix1 opened this issue Oct 13, 2024 · 2 comments · Fixed by #2344
Assignees

Comments

@lonix1
Copy link

lonix1 commented Oct 13, 2024

I'm using the partitioned rate limiter (so I can chain multiple rate limiters), which as far as I understand is based on an implementation by the framework itself.

There is a concept of a "partition key", but it's explained neither in the Polly docs nor in the framework docs. It's also not covered explicitly by anything on StackOverflow.

After trial-and-error I realised:

  • for incoming requests: it allows for policies-per-users, e.g. partitioned by username, IP address, access token
  • for outgoing requests to external APIs: one would probably use a constant partition key, e.g. "aws-sns-service", "azure-auth-service"

It would be helpful to add a small explanation in the docs because this was confusing. (I can't submit a PR as I'm still not certain my above understanding is correct).

@martincostello
Copy link
Member

That's basically the explanation yes. It's effectively a key for the "shard" to track the counts against, so for a user it might be their user ID for example.

I'll add a brief aside when I add a chained rate limiting example, but if it's not explained at all in the docs for rate limiting itself I suggest opening an issue against the Microsoft documentation to have it explained there.

@lonix1
Copy link
Author

lonix1 commented Oct 13, 2024

Good idea! I did that here.

martincostello added a commit to martincostello/Polly that referenced this issue Oct 13, 2024
Add example for chained rate-limiters.

Resolves App-vNext#2343.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants