`multiple Apache APISIX instances` is not a problem here, the architecture
diagram mainly describes the Redis side.

you can refer to the implement of the limit-count plugin[1], which is also
supported Redis.

I have one question:
Is there a performance impact if you run Lua script in Redis?
Can we run related Lua code in the Apache APISIX side, and only using Redis as
a public token bucket?
We optimized for LuaJIT in Apache APISIX. But it will not effective in
Redis.

[1]
https://github.com/apache/incubator-apisix/blob/master/lua/apisix/plugins/limit-count.lua

Thanks,
Ming Wen, Apache APISIX
Twitter: _WenMing


YuanSheng Wang <[email protected]> 于2020年1月6日周一 下午12:11写道:

> Hi:
>
> Found a problem, only `shdict` is not enough, because APISIX Gateway allows
> multiple instances.
>
>
> On Mon, Jan 6, 2020 at 11:55 AM Law Sheldon <[email protected]>
> wrote:
>
> > The picture url: http://p0.qhimg.com/t019b29b44ac6e1b307.png
> >
> > 发件人: Law Sheldon <[email protected]>
> > 答复: "[email protected]" <[email protected]>
> > 日期: 2020年1月6日 星期一 上午11:32
> > 收件人: "[email protected]" <[email protected]>
> > 主题: [DISCUSS] Add distributed token bucket limit plugin based on Redis
> >
> >
> > Hello, everyone
> >
> >
> >
> > I want to add a distributed token bucket limit plugin based on Redis.
> > Although most of the existing current limit plugins have already been
> used
> > in most scenarios, there are still some specific scenarios that need to
> > implement distributed speed limiting.
> >
> > Token bucket-based speed limit can effectively correct traffic spikes
> > caused by fixed-time window current limit and make limiting smoothly.
> >
> > And we hope that the limit algorithm can limit the flow based on your own
> > custom keywords. These keywords can be the header used to mark the source
> > app, or it can be a query parameter.
> >
> >
> >
> > How to do it? We package the token bucket algorithm into a Lua script,
> use
> > the Redis “script load” command to load the token bucket algorithm into
> the
> > Redis Server, and then perform the current limit through “evalsha”
> command.
> >
> >
> >
> >
> >
> > [cid:[email protected]]
> >
> >
> >
> > Can anyone give some advice? Is this needed for APISIX?
> >
> >
>
> --
> *MembPhis*
> My github: https://github.com/membphis
> Apache APISIX: https://github.com/apache/incubator-apisix
>

Reply via email to