Couper Documentation

edge

Rate Limit (Beta)

Rate limiting protects backend services. It implements quota management used to avoid cascading failures or to spare resources.

Block nameContextLabel
beta_rate_limitnamed backend blockno label

Attributes

NameTypeDefaultDescription
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 unitsDescription
nsnanoseconds
us (or ยตs)microseconds
msmilliseconds
sseconds
mminutes
hhours