lovelock opened a new pull request, #13759:
URL: https://github.com/apache/apisix/pull/13759
Introduces a new plugin that distributes a cluster-wide global rate across N
nodes using a shared metadata-driven instance_count.
Behavior:
local_rate = global_rate / instance_count
local_burst = global_burst / instance_count
instance_count is stored in plugin_metadata, refreshed every 10s by a
per-worker background timer. Defaults to 1 when metadata is unset.
Default rejected_code is 429 (Too Many Requests).
### Description
Standard limit-req is per-node: N nodes each with rate=100 effectively allow
N*100 req/s cluster-wide.
This plugin solves this by accepting a global_rate at the route level and
computing local_rate = global_rate / instance_count per node. instance_count is
configured cluster-wide via plugin_metadata, and each node's timer picks it up
every 10 seconds.
The approach uses only local shared dicts (no cross-node coordination),
making it efficient and avoiding single points of failure.
#### Which issue(s) this PR fixes:
N/A — new feature.
### Checklist
- [x] I have explained the need for this PR and the problem it solves
- [x] I have explained the changes or the new features added to this PR
- [x] I have added tests corresponding to this change
- [ ] I have updated the documentation to reflect this change
- [ ] I have verified that this change is backward compatible (If not,
please discuss on the [APISIX mailing
list](https://github.com/apache/apisix/tree/master#community) first)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]