Skip to content

Commit 6220dd5

Browse files
committed
Remove references to timeout and waiting for tokens to become available
1 parent 1e72764 commit 6220dd5

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

user-manual/src/config/kdl.md

+5-28
Original file line numberDiff line numberDiff line change
@@ -290,48 +290,25 @@ rate-limiting {
290290
}
291291
```
292292

293-
#### `services.$NAME.rate-limiting.timeout`
294-
295-
The `timeout` parameter is used to set the total timeout for acquiring all rate limiting tokens.
296-
297-
If acquiring applicable rate limiting tokens takes longer than this time, the request will not be
298-
forwarded and will respond with a 429 error.
299-
300-
This parameter is mandatory if the `rate-limiting` section is present.
301-
302-
This is specified in the form:
303-
304-
`timeout millis=TIME`, where `TIME` is an unsigned integer
305-
306-
**Implementation Note**: The rate limiting timeout is a temporary implementation detail to limit
307-
requests from waiting "too long" to obtain their tokens. In the future, it is planned to modify
308-
the leaky bucket implementation to instead set an upper limit on the maximum "token debt", or
309-
how many requests are waiting for a token. Instead of waiting and timing out, requests will instead
310-
be given immediate feedback that the rate limiting is overcongested, and return a 429 error immediately,
311-
instead of after a given timeout.
312-
313-
When this change occurs, the `timeout` parameter will be deprecated, and replaced with a `max-token-debt`
314-
parameter instead.
315-
316293
#### `services.$NAME.rate-limiting.rule`
317294

318295
Rules are used to specify rate limiting parameters, and applicability of rules to a given request.
319296

320297
##### Leaky Buckets
321298

322299
Rate limiting in River uses a [Leaky Bucket] model for determining whether a request can be served
323-
immediately, or if it should be delayed (or rejected). For a given rule, a "bucket" of "tokens"
324-
is created, where one "token" is required for each request.
300+
immediately, or if it should be rejected. For a given rule, a "bucket" of "tokens" is created, where
301+
one "token" is required for each request.
325302

326303
The bucket for a rule starts with a configurable `tokens-per-bucket` number. When a request arrives,
327304
it attempts to take one token from the bucket. If one is available, it is served immediately. Otherwise,
328-
the request waits in a first-in, first-out order for a token to become available.
305+
the request is rejected immediately.
329306

330307
The bucket is refilled at a configurable rate, specified by `refill-rate-ms`, and adds a configurable
331308
number of tokens specified by `refill-qty`. The number of tokens in the bucket will never exceed the
332309
initial `tokens-per-bucket` number.
333310

334-
Once a refill occurs, requests may become ready if a token becomes available.
311+
Once a refill occurs, additional requests may be served.
335312

336313
[Leaky Bucket]: https://en.wikipedia.org/wiki/Leaky_bucket
337314

@@ -361,7 +338,7 @@ potentially defeating the objective of accurate rate limiting.
361338
When multiple rules apply to a single request, for example rules based on both source IP address,
362339
and the URI path, then a request must claim ALL applicable tokens before proceeding. If a given IP
363340
address is making it's first request, but to a URI that that has an empty bucket, it will immediately
364-
obtain the IP address token, but be forced to wait until the URI token has been claimed
341+
obtain the IP address token, but the request will be rejected as the URI bucket claim failed.
365342

366343
##### Kinds of Rules
367344

0 commit comments

Comments
 (0)