'Redisson Rate limiting with RabbitMQ

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.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source