qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alan Conway <acon...@redhat.com>
Subject Dynamic balancing of queues.
Date Fri, 08 Sep 2006 15:30:56 GMT
Just got thinking about this - how to ensure work is distributed

Simple case: 1 q many consumers. Automatically balances itself because
consumers request messages at exactly the rate they can consume them.

To scale up we need more qs. The demo aims for balance by having an
exchange that tries to keep the queues to the same length.

When work is coming in faster than it's being processed the exchange can
balance the queues by adding messages to the short queues.

But what happens during slow periods when work is processed faster than
it comes in? The fast queues are emptying out and there's work trapped
on the slow queues. The exchange can't balance things by adding messages
because there are no new messages to add.

So let the exchange act as a consumer and *remove* messages from
over-full queues to re-queue them on under-full/empty ones. Now we have
a full dynamic balance in both growing and shrinking phases

This gives us the best balance but it incurs overhead when the broker
has to move message between queues. So perhaps a final optimization is
to have the exchange track not only the fullness of the queues but the
rate at which they empty. Then instead of aiming for every q having the
same length, it can (over time) aim for queues to be filled in
proportion to their throughput. I need to think about that some more
optimization strategies don't always perform the way you expect!


View raw message