[zeromq-dev] Load balancing algorithm

Martin Hurton hurtonm at gmail.com
Fri Jul 9 10:04:22 CEST 2010


On Fri, Jul 9, 2010 at 9:53 AM, Martin Sustrik <sustrik at 250bpm.com> wrote:
> Brian Granger wrote:
>
>>> We have an estimate of how many messages there are in each pipe.
>>>
>>> HWM-style load balancing -- as it is implemented at the moment -- is a
>>> round-robin over all the pipes that are not full.
>>>
>>> Choosing the least filled pipe may be computationally complex (at least
>>> O(log n)), so using the algorithm described in the article may be a nice
>>> optimisation.
>>
>> Is the information about how much each pipe has in it available in the
>> pipe API.  If so I might give this a shot.
>
> I think the estimate can be computed like this:
>
> pipe_t::writer_t::msgs_written - pipe_t::writer_t::msgs_read
>
> Martin Hurton wrote the code, so he may confirm.

This is correct. I can add a method for this, if it helps.

- MH

>
> Martin
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list