Skip to content

In-Flight Request Limiting

To proactively prevent services from being overwhelmed with high load, a limit on the number of simultaneous in-flight requests can be applied.

Traefik Enterprise supports distributed in-flight request limiting. It's a middleware just like Traefik Proxy's in-flight request limiting middleware, but it ensures that requests are limited over time throughout your cluster and not just on an individual proxy.

Configuration Example

To use distributed in-flight request limiting, you'll need to deploy a service with the middleware enabled. Here are some examples depending on the provider you're using:

labels:
  - "traefik.http.middlewares.test-inflightreq.plugin.inflightreq.amount=10"
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: test-inflightreq
spec:
  plugin:
    inFlightReq:
      amount: 10
# Here, an average of 100 requests per second is allowed.
# In addition, a burst of 50 requests is allowed.
http:
  middlewares:
    test-inflightreq:
      plugin:
        inFlightReq:
          amount = 10
# Here, 10 concurrent in-flight requests are allowed
# throughout the cluster.
[http.middlewares]
  [http.middlewares.test-inflightreq.plugin.inFlightReq]
    amount = 10

Configuration Options

For more information on the different configuration possibilities (amount, sourceCriterion etc.), refer to the Traefik Proxy Reference.

Migrating from Traefik Proxy

If a Traefik Proxy configuration for the in-flight request limiting middleware exists, it can adapted for Traefik Enterprise simply by using plugin.inFlightReq instead of inFlightReq. See the examples above for the different providers.

A Traefik Proxy middleware configuration can be kept, which will run the non-distributed version of the middleware on each proxy. This means the limiting is per-proxy and not throughout the entire cluster, so be careful.