Rate Limit (Beta)
Rate limiting protects backend services. It implements quota management used to avoid cascading failures or to spare resources.
| Block name | Context | Label |
|---|---|---|
beta_rate_limit | named backend block | no label |
Attributes
| Name | Type | Default | Description |
|---|---|---|---|
mode | string | "wait" | If mode is set to block and the rate limit is exceeded, the client request is immediately answered with HTTP status code 429 (Too Many Requests) and no backend request is made. If mode is set to wait and the rate limit is exceeded, the request waits for the next free rate limiting period. |
per_period | number | - | Defines the number of allowed backend requests in a period. |
period | duration | - | Defines the rate limit period. |
period_window | string | "sliding" | Defines the window of the period. A fixed window permits per_period requests within period after the first request to the parent backend. After the period has expired, another per_period request is permitted. The sliding window ensures that only per_period requests are sent in any interval of length period. |
Duration
Values of type duration are provided as number string followed by a unit listed below.
Example: timeout = "300s"
| Duration units | Description |
|---|---|
ns | nanoseconds |
us (or µs) | microseconds |
ms | milliseconds |
s | seconds |
m | minutes |
h | hours |