Skip to content

Epsilon-Greedy seems an odd choice for a load-balancer #2

Open

Description

@dgryski

I would have assumed "two random choices" would have given a better lower average load.

Given that you're already tracking latency information for epsilon-greedy, implementing two random choices should be fairly straight-forward.

For more information on "two random choices", see http://www.eecs.harvard.edu/~michaelm/postscripts/handbook2001.pdf .

Activity

  1. jehiah commented on May 9, 2013

    @jehiah
    Member

    Interesting. This does sounds like it might have some useful properties. I'd love to see how this works out if you get a prototype implemented.

    The Epsilon-Greedy is certainly an experiment, and it's on our to-do list to describe some of how that has worked in a few select cases at bitly. There are lots of cases where it's useless, but we've found at least one where it's very valuable.

  2. dgryski commented on May 10, 2013

    @dgryski
    Author

    Since epsilon greedy already has all the time tracking, the 'easiest' way to prototype this is just to directly replace the loop that does the selection that begins "if len(possibleHosts) != 0" near epsilon_greedy.go:130 . Note this is completely untested, but it does compile :)

        switch n := len(possibleHosts); n {
        case 0:
            hostToUse = nil
        case 1:
            hostToUse = possibleHosts[0]
        default: // n > 0
    
                idx1 := rand.Intn(n)
                h1 := possibleHosts[idx1]
                // remove h1 from list of hosts -- sample without replacement
                n--
                possibleHosts[idx1] = possibleHosts[n]
                possibleHosts = possibleHosts[:n]
    
                idx2 := rand.Intn(n)
                h2 := possibleHosts[idx2]
    
                if h1.epsilonValue > h2.epsilonValue {
                    hostToUse = h1
                } else {
                    hostToUse = h2
                }
        }
    

    I'll unfortunately be unable to tes this further right now. I won't have time to play with this until closer to the end of May.

  3. dgryski commented on Jul 23, 2014

    @dgryski
    Author

    Just realized I never came back to play with this. I still think this change makes sense. Not sure how to test this to see if it actually gives more evenly distributed load though..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions