Skip to content

Add rate limits initial documentation - #1450

Merged
nicu-da merged 6 commits into
mainfrom
nicu/rate_limits/initial_docs
Aug 26, 2026
Merged

Add rate limits initial documentation#1450
nicu-da merged 6 commits into
mainfrom
nicu/rate_limits/initial_docs

Conversation

@nicu-da

@nicu-da nicu-da commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Signed-off-by: Nicu Reut <nicu.reut@digitalasset.com>
@mintlify

mintlify Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
cantonfoundation 🟢 Ready View Preview Aug 24, 2026, 8:22 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@martinflorian-da martinflorian-da left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks a lot! I do expect we'll need to tweak this more going forward but this is super helpful to maintain an overview.

My main nudge at this time would be to remove references to SV app...

Comment thread docs-main/global-synchronizer/production-operations/sv-rate-limits.mdx Outdated
</Warning>

```hocon
canton.scan-apps.scan-app.parameters.rate-limiting.client-ip-headers = ["x-envoy-external-address"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems to miss a sentence about "what is this snippet here telling me".

It will also confuse people not used to thinking about the low-level HOCON configs; WDYT of making these two name: ADDITIONAL_CONFIG_... style snippets instead?

...and possibly we also want to expose these via Helm values at some point? (So might need a hook here to replace with Helm value overrides if we end up enabling these.)

Comment thread docs-main/global-synchronizer/production-operations/sv-rate-limits.mdx Outdated

Both limits must be enforced over a **fixed window of 60 seconds**. A client is allowed at most `limit` requests per 60s window; once the budget for the current window is exhausted, all further requests from that client (or, for the global limit, to that service) are rejected with `429 Too Many Requests` until the window rolls over.

For the sequencer, limits must be applied to gRPC traffic requests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How confident are you that you can throw "gRPC traffic request" at operators and they'll end up configuring the right thing? Can this be mapped to something on a lower layer (HTTP2?)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I expect that most proxies have native support for gRPC. Will just switch to gRPC (HTTP2)

Comment thread docs-main/global-synchronizer/production-operations/sv-rate-limits.mdx Outdated
Comment thread docs-main/global-synchronizer/production-operations/sv-rate-limits.mdx Outdated
Comment thread docs-main/global-synchronizer/production-operations/sv-rate-limits.mdx Outdated
@nicu-da

nicu-da commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

Thanks a lot! I do expect we'll need to tweak this more going forward but this is super helpful to maintain an overview.

My main nudge at this time would be to remove references to SV app...

I definitely expect we keep evolving this in the short to medium term, but wanted to front run this so that SVs can also get a head start on basic rate limits.

Comment thread docs-main/global-synchronizer/production-operations/sv-rate-limits.mdx Outdated
Comment thread docs-main/global-synchronizer/production-operations/sv-rate-limits.mdx Outdated
Co-authored-by: Martin Florian <martin.florian@digitalasset.com>
Co-authored-by: Nicu Reut <nicu.reut@digitalasset.com>
Comment thread docs-main/global-synchronizer/production-operations/sv-rate-limits.mdx Outdated
Signed-off-by: Nicu Reut <nicu.reut@digitalasset.com>
.
Signed-off-by: Nicu Reut <nicu.reut@digitalasset.com>
@nicu-da

nicu-da commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

@stas-sbi asking for a review from you as well to make sure we're aligned on the initial version/requirements for infra rate limiting

@giner giner left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me! Left a few minor comments

Comment on lines +25 to +27
The default headers (`x-forwarded-for`, `x-real-ip`) are client-controlled and can be spoofed. A client rotating the header value bypasses per-client-IP limits entirely.

Every SV operator must therefore either configure their ingress to **overwrite** (not append to) the header the apps read, or point `client-ip-headers` at a header the client cannot influence. With an Istio/Envoy ingress the recommended value is the non-spoofable `x-envoy-external-address`. Make sure the number of trusted XFF hops on your gateway matches your actual topology, so Envoy derives the real client IP.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Considering that the terms spoofable and non-spoofable are meaningless outside of specific context I'd like to suggest simplifying this section and replacing it with something like:

The default value for rate-limiting.client-ip-headers is set to ["x-forwarded-for", "x-real-ip"] as a convenience trade-off. Every SV operator must configure set rate-limiting.client-ip-headers to the header fully controlled (rewritten, not passed through or appended to) by their ingress. For example ["x-forwarded-for"] or ["x-envoy-external-address"].

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks, applied

The following infrastructure level rate limits should be configured. These limits should apply individually to the Scan API and the sequencer gRPC API.

- **Global limits**: a cap on the total request rate reaching a given service.
- **Per-source-IP limits**: a cap on the request rate of a single client IP, so a single client cannot consume the global budget.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it would make sense to note that these limits are last resort and they must be higher than app limits

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added a note


Both limits must be enforced over a **fixed window of 60 seconds**. A client is allowed at most `limit` requests per 60s window; once the budget for the current window is exhausted, all further requests from that client (or, for the global limit, to that service) are rejected with `429 Too Many Requests` until the window rolls over.

For the sequencer, limits must be applied to gRPC(HTTP/2) traffic requests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this sounds as if there were other options but I can't think of any, so I'm not sure what this comment intends to say

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

leaving it there just so that it's extra explicit


### Shared rate limiter configuration

The same shared rate limiter configuration file that defines application-level overrides will also define a number of infrastructure level configurations (global and per-IP limits, the 60s rate limiting interval, per IP overrides, and any ban thresholds) that should be applied to the ingress by the SV operator.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this say suggested infrastructure level configurations?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yup, reworded

.
Signed-off-by: Nicu Reut <nicu.reut@digitalasset.com>
@nicu-da
nicu-da enabled auto-merge (squash) August 26, 2026 11:35
@nicu-da
nicu-da merged commit b675cf8 into main Aug 26, 2026
3 of 4 checks passed
@nicu-da
nicu-da deleted the nicu/rate_limits/initial_docs branch August 26, 2026 11:37
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