Go to new doc!

+49 228 5552576-0


info@predic8.com

Rate Limiting and Throttling

Rate limiting allows a certain number of requests in a given interval.

When a request is send and the rate limit is not reached the request is forwarded to the target, see figure 1. The procedure is as follows: (1) The client sends a request. (2) Membrane validates that the rate limit is not reached and forwards the request.

Rate limit not reached

Figure 1: Rate limit not reached

When a request is send and the rate limit is reached the request isn't forwarded to the target, see figure 2. The procedure is as follows: (1) The clients sends the request. (2) Membrane validates that the rate limit is reached and responds with HTTP-Statuscode 429.

Rate limit reached

Figure 2: Rate limit reached

The caller is informed at which time calls are allowed again when the request limit is reached.

Rate limit reached curl response

Figure 3: Header when limit is reached

Configuration

Figure 4 shows an example configuration for rate limiting. Requests are limited to 3 requests in 30 seconds.

Example Proxies.xml for rate limiting

Figure 4: Example Proxies.xml for rate limiting

Getting started

See examples/rateLimiter/README.txt in the membrane folder and try it yourself.