用RabbitMQ限制Redisson速率

发布于 2025-01-29 07:53:17 字数 619 浏览 4 评论 0原文

我正在尝试使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文