Hello,

I think you should first add up the weights to reach a total, then generate
a random number and mod that to the total sum. Then readd from each item's
weight until you reach the moded sum. HTH.

Regards,

SZ

On Tue, Dec 15, 2009 at 1:45 PM, Stanislav <stas...@orc.ru> wrote:

> Hi, everybody,
>
> I need to implement a kind of weighted round robin distribution
> for HTTP ICS-based reverse-proxy. I've found some info about
> packets distribution but neither about users (sessions) distribution.
> The difference is that, according to the algorithms, packets can be
> left in a queue (so load balancing is achieved), while users should not.
>
> The given data is a list of N servers and their relative weights W[n].
>
> Could someone suggest a link for appropriate algorithm?
>
> I tried to use the well-known round robin modification of constructing
> a virtual cicrle, divided into N sectors, each of which is proportional
> to corresponding server weight. But it may produce very uneven
> distribution in time, that is for a period it draws a series with some
> servers probabilities far from their weights, then it begins to draw
> a series with other servers probabilities far from their weights.
> I could show an example, but it's not necessary, I think.
> For a large period the mean values approximate to the weights.
> But I'd like to have a short time smooth distribution.
>
> Thanks in advance.
>
> Best wishes,
> Stanislav Korotky.
> --
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to