用RabbitMQ限制Redisson速率
我正在尝试使用redisson速率限制API(下面的链接)来对限制兔子消费者的速率消耗Q。目前,速率可限制为每秒5条消息,而不是每秒16个消息。使用@rabbitlistener()注释,我将RMQ消费者编号提高到8。
https://redisson.org/glossary/rate-late-late-late-limiter.html
如下所示
limiter.trySetRate(RateType.OVERALL, 16, 1, RateIntervalUnit.SECONDS);
,在消费者类中,
rateLimiter.acquire(1);
想法是在2个实例中有16个消费者,每个消费者每秒获得1个令牌,将消费者的利率限制在16/s。但是,由于某种原因,它被上限为5/秒。消费者正在进行休息电话,最大约为300-500ms。不知道为什么我无法获得16TP。
如果有人可以阐明这个问题,将会有所帮助。
I am trying to use Redisson Rate limiting API (link below) to rate-limit RabbitMQ consumers consuming the message from Q. Currently, it is rate-limited to 5 messages per second instead of 16 per second. I have increased the RMQ consumer number to 8 with @RabbitListener() annotation.
https://redisson.org/glossary/rate-limiter.html
My limiter configuration is as follows
limiter.trySetRate(RateType.OVERALL, 16, 1, RateIntervalUnit.SECONDS);
and in consumer class
rateLimiter.acquire(1);
the idea is that there are 16 consumers in 2 instances and each consumer gets 1 token per second restricting the consumer rate to 16/s. However, for some reason, it is capped at 5/second. The consumer is making a rest call out and it takes around 300-500ms max. Not sure why I cannot achieve a 16tps.
It will be helpful if someone can shed light on the issue.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论