I am looking at any library/implementation which implements rate-limiting like Guava ratelimiter. However I am also trying to ensure fairness.
For example, lets say there are 3 queues Q1, Q2, Q3 each receiving messages. The processing rate of the system can only support 1000 messages per second.
With guava I can configure a token based rate limiter that will gives a constant 1000 tokens per second. However, there is no guarantee that Q1, Q2 and Q3 will receive same number of tokens per second.
A simple way would be to create 3 rate limiters with 1000/3 = 333 tokens per second and assign them to each queue. However, in that case, the system becomes sub-optimal.
Is there any easy or simple way to achieve this without writing code from scratch ? Ideally I would want to limit each queue to a set rate - for example Q1 is allowed upto 100 TPS, Q2 - 200 TPS, Q3: 700 when the system is at full capacity.