Rate-limiting across connections

Yichun Zhang (agentzh) agentzh at gmail.com
Fri Nov 14 21:44:02 UTC 2014


Hello!

On Fri, Nov 14, 2014 at 11:31 AM, B.R. <reallfqq-nginx at yahoo.fr> wrote:
> The limit_rate directive documentation clearly states that it is applied on
> a per-request basis.
> How would one rate-limit a client over N connections?
>

It's easy to do if you use ngx_lua module [1] together with the
$limit_rate builtin variable. You can not only limit on a per-server
basis (across worker processes) but also limit on a cluster-level
(across machines). It's all up to you. Thanks to the flexibility of
Lua.

Regards,
-agentzh

[1] https://github.com/openresty/lua-nginx-module



More information about the nginx mailing list