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

Balancer Time_Wait Issue #3

Open
Bubsavvage opened this issue Jul 10, 2019 · 1 comment
Open

Balancer Time_Wait Issue #3

Bubsavvage opened this issue Jul 10, 2019 · 1 comment

Comments

@Bubsavvage
Copy link

Bubsavvage commented Jul 10, 2019

My team is using the load balancer to horizontally scale and provide processing retention for an application that does cpu intensive calculations on data. The issue we are running into is that it doesn't seem configuring transport attributes on the RoundTripper is not quite opened up for us yet, unless its intended for us to use the http.DefaultTransport. We want to change the MaxIdleConns and MaxIdleConnsPerHost to help avoid time_waits when making requests. Perhaps leaving a parameter open for us when creating the balancer to set our transport will be useful. Just a suggestion really.

@olivere
Copy link
Owner

olivere commented Jul 10, 2019

You're correct. What about changing Transport to something like this?

type Transport struct {
  next http.RoundTripper
  b     Balancer
  ...
}

func NewTransport(b Balancer, options ...TransportOption) *Transport {
  t := &Transport{
    next: http.DefaultTransport,
    b: b,
  }
  for _, option := range options {
    option(t)
  }
  ...
}

type TransportOption func(*Transport)

func WithRoundTripper(r http.RoundTripper) TransportOption {
  return func(t *Transport) {
    t.next = r
  }
}

...

Maybe we need to change NewClient, too. Or at least provide more options to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants