Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1: add support for multiple endpoints #339

Closed
rboyer opened this issue Nov 10, 2017 · 4 comments
Closed

v1: add support for multiple endpoints #339

rboyer opened this issue Nov 10, 2017 · 4 comments

Comments

@rboyer
Copy link
Contributor

rboyer commented Nov 10, 2017

If you run a replicated mesos-master setup (say N=3) then the current state of how you inform the HTTP API client of the masters is:

  1. pick one, and use httpcli.Endpoint to save it
  2. hope it never goes down
  3. let the 307 redirection code ask any master for the leading master and update your favorite

This works ok enough until the selection from (1) is not responsive. Then you have to cobble together some sort of much higher level round-robin over a list of mesos-master addresses.

It would be cool if the httpcli.Client could take one of the following:

// NextEndpointFunc returns a new endpoint to try.  
type NextEndpointFunc func() string

// example of NextEndpointFunc
func simpleRoundRobin(urls []string) httpcli.NextEndpointFunc {
       var pos int
       return func() string {
               if pos >= len(urls) {
                       pos = 0
               }
               s := urls[pos]
               pos++
               return s
       }
}
// EndpointProviderFunc could hook into a service-discovery option or flat config file
type EndpointProviderFunc func() []string

// example of EndpointProviderFunc from a flat file:
func staticHosts(urls []string) httpcli.EndpointProviderFunc {
    return urls
}

And then have it rotate through the options down wherever c.url is referenced when there's an error indicative of a dead or bad master.

@rboyer
Copy link
Contributor Author

rboyer commented Nov 10, 2017

This would relate to #338

@jdef
Copy link
Contributor

jdef commented Nov 20, 2017

I like the proposed interface. Which specific failures would trigger calls to such an interface? "no such host"? "connection timeout"? something else?

@mlowicki
Copy link

#352 is marked as merged. Does it mean that this ticket has been solved?

@jdef
Copy link
Contributor

jdef commented Oct 19, 2018

Yes I believe this is resolved. Closing out. Please re-open if you feel that something here has been left unaddressed.

@jdef jdef closed this as completed Oct 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants