Hacker News new | ask | show | jobs
by manigandham 1280 days ago
If it’s round robin then it should be an even load, how does the modulo change that exactly?

Also what number are they using to modulo and where is that happening? Because at that point don’t they already have an incrementing ID before generating another one?

1 comments

Take a 3-bit counter:

    0->A
    1->B
    2->C
    3->A
    4->B
    5->C
    6->A
    7->B
A and B get hit three times while C only twice, so it will see 66% utilization compared to A and B

EDITED s/once/twice/ thanks CyberDildonics

while C only once

You listed C twice

That's a typo. You can still see they're correct about the ratio (two "C"s for every three "A"s and "B"s).
There's no ratio. It's even across all of them, as long as the integer keeps incrementing. One more number (9) instead of stopping at 8 and there would be an even spread.
Not when the counter overflows back to 0. If it's a 3 bit counter, 0 is A again, not C.
The comment says a 32-bit signed int. Where is the 3-bit assumption coming from?
Edited, thanks
That doesn't change anything... it's still round robin. You just stopped at an arbitrary number of 8 integers instead of 9.
It's not arbitrary, GP stated it was a 3 bit counter. In GGP (or something, not sure how far down in the thread we are), they were referring to a 32 bit int counter until overflow. If you bin each number from 0 to 2^32 - 1 by mod 3, you don't get 3 bins of equal sizes, 1 bin always comes out smaller.
Smaller by a single number at most, it's effectively insignificant. Not sure where the 3-bit counter assumption came from as the original post said 32bit signed int.