Open Source API Gateway

throttle

Version

Throttles incoming traffic by delaying requests and/or capping how many are processed concurrently, to protect a backend from overload. With delay set, every request is held briefly before it continues. With maxThreads set, a request that arrives while the limit is already reached is rejected with 503 once no slot frees up. See the examples under examples/routing-traffic/throttle.

Example Configuration

api:
port: 2000
flow:
- throttle:
maxThreads: 10
busyDelay: 3000
target:
url: https://api.predic8.de
api:
  port: 2000
  flow:
    - throttle:
        maxThreads: 10
        busyDelay: 3000
  target:
    url: https://api.predic8.de

Syntax

throttle:
busyDelay: <int>
delay: <int>
maxThreads: <int>
throttle:
  busyDelay: <int>
  delay: <int>
  maxThreads: <int>

Attributes

NameRequiredDefaultDescriptionExamples
busyDelay0When maxThreads is reached, the maximum time in milliseconds a request waits for a slot to free up before it is rejected with 503. 0 rejects immediately.3000
delay0Milliseconds to hold every request before it continues. 0 disables the delay.1000
maxThreads0Maximum number of requests processed concurrently. A request arriving while the limit is reached waits up to busyDelay for a slot to free up and, if none does, is rejected with 503. 0 means unlimited.5

Can be used in

Show all 24 parent elements