Thanks Cooper, for your answer on the other thread.
I just submitted a pull request on github implementing this.
feat(rate-limiting) global rate-limiting to protect back-end
by julienlau on 04:19PM - 27 Nov 18 UTC
1 commits changed 2 files with 4 additions and 2 deletions.
You do not need to recompile anything to use it.
Overwrite the lua scripts from your existing rate-limiting plugin and restart kong.
git clone blabla
scp kong/plugins/rate-limiting/handler.lua scp kong/plugins/rate-limiting/schema.lua root@server-kong:/usr/local/share/lua/5.1/kong/plugins/rate-limiting/
It does not bother me that one consumer could block the others by reaching the global limit.
In fact, I am currently implementing this with 2 layers:
- one rate-limiting at a global level, in which I can set limits according to hard limits of the back-end servers and protect the platform from being flooded.
- one rate-limiting per consumer, which is independent from hardware/tech stack considerations and more linked to the contract that I have with them.
But in any case, I do not want to the math: I have N concurent consumers and platform capacity is X q/s so, I only have to put X/N as a rate limit to all consumers.
In my case Availability is more important than Latency and the usage of consumers is not well known… yet
If one consumer is flooding the service thanks to a high q/s limit per consumer, he will soon be blocked in terms of q/m, q/h, q/d so that the platform will be able to answer without completely breaking due to an overwhelming backlog of requests to DB.