[英]Spring Cloud - Redis Rate Limiting - Not working for request per minute
My particular use case is I want to implement the rate limiting at the spring cloud gateway using redis rate limiter eg 4 requests per minute for particular route.我的特定用例是我想使用 redis 速率限制器在 spring 云网关上实现速率限制,例如特定路由每分钟 4 个请求。
But it is not working as expected it automatically fills bucket as soon as one request completed.但它没有按预期工作,一旦完成一个请求,它就会自动填充存储桶。 Used the same implementation as provided by the spring cloud forum but not able to limit my request for particular time window:使用了与 spring 云论坛提供的相同实现,但无法限制我对特定时间 window 的请求:
Rate limits bellow 1 request/s are accomplished by setting replenishRate to the wanted number of requests, requestedTokens to the timespan in seconds and burstCapacity to the product of replenishRate and requestedTokens, eg setting replenishRate=1, requestedTokens=60 and burstCapacity=60 will result in a limit of 1 request/min.低于 1 request/s 的速率限制是通过将replenishmentRate 设置为所需的请求数、将requestTokens 设置为以秒为单位的时间跨度并将burstCapacity 设置为replenishRate 和requestedTokens 的乘积来实现的,例如设置replenishRate=1、requestedTokens=60 和burstCapacity=60 将导致限制为 1 个请求/分钟。
TIA TIA
Got it working after updating spring cloud version to 2020.0.2将 spring 云版本更新到 2020.0.2 后可以正常工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.