Rate limiting you can trip yourself
Press Send six times and watch the sixth one fail - that is the lesson.
Open this lesson in the learning hubKey points
- Rate limiting protects your upstream from one noisy caller taking everything down.
- Kong counts per consumer when it knows one, and per IP when it does not.
- Rejected requests are stopped at the gateway, so the cost of an overload never reaches your service.
- The
localpolicy counts per Kong node and is fast;rediscounts cluster-wide and is exact. - Kong returns
429plus headers telling the caller how much quota is left.
Example
plugins:
- name: rate-limiting
route: orders-api
config:
minute: 5
policy: local # per node; use redis for a cluster-wide count
limit_by: consumer
Rate limiting rejects the overflow at the gateway, so your upstream only ever sees traffic it can handle.
This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the Kong Course course, and every lesson in it is listed on the Kong Course contents page.