Rate Limiting by namespace

Hi QQ,
Is there a way we can configure rate limit by namespace in the temporal server?

You can use dynamic config to control namespace rps per instance of frontend role:

@samar thank you, does that mean once I set this, all namespace will share the same limit. we cannot do per namespace limit yet, right?

This limit will be enforced per namespace. Meaning let’s say you set frontend.namespacerps to 100 then both namespace A and B can perform 100 rps per frontend host before getting throttled. So overall frontend rps could be 200. This knob allows to configure different limits per namespace. For instance you can have a limit of 100 for namespaceA and 500 for namespaceB. If you want to have a global limit for the entire frontend please use frontend.rps.

to have different value for different namesapce, whats the example value?

  • value:
    “namespaceA”: “valueA”
    “namespaceB”: “valueB”
    Or something else?

@samar can you answer my question above? what the example for value for per namespace rate limiting

Hey @Steven_Sun, you can provide a custom value which applies to all namespaces by updating the dynamic config. The following dynamic config will apply the limit of 2000 rps for each namespace on a single host.

frontend.namespacerps:
- value: 2000
  constraints: {}

If you want to have a different value for namespaces you can specify namespace constraints for each namespace with a different value.

frontend.namespacerps:
- value: 2000
- value: 100
  constraints:
    namespace: "namespaceA"
- value: 500
  constraints:
    namespace: "namespaceB"

The above config will limit namespaceA rps to 100 and namespaceB rps to 500. All others will use 2000 rps.

Please refer to dynamic config docs for more information.

1 Like

Thanks Samar