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

Sane default and configurable Marathon request timeouts #3286

Merged
merged 4 commits into from
May 22, 2018

Conversation

m3co-code
Copy link
Contributor

@m3co-code m3co-code commented May 8, 2018

What does this PR do?

Set sane timeouts for requests to Marathon and make them configurable.

Motivation

Before the timeouts were either overly excessive or not existent at all. For requests done by go-marathon there was no timeout, which means when there was temporarily a network problem which doesn't immediately show a failure (e.g. when the packets are dropped by a firewall) Traefik will never be able to create a connection to Marathon, as this one request will be running basically forever. I used the same timeouts as go-marathon does by default. We have to do this in Traefik as we pass in our own http.Client.

More

  • Added/updated tests: -> no adaption of tests required for this PR
  • Added/updated documentation

@m3co-code m3co-code requested a review from a team as a code owner May 8, 2018 11:50
@m3co-code m3co-code changed the title Sane Marathon request timeouts sane Marathon request timeouts May 8, 2018
Copy link
Contributor

@timoreimann timoreimann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely worthwhile.

Two questions:

  1. Do we need to make the timeouts configurable? That is, could there be users that whose workflow breaks with the new, more strict timeouts?
  2. Should this PR go into the release branch as a regular bugfix? Personally I'd say so iff the answer to the first question is "no".

@m3co-code
Copy link
Contributor Author

  1. I think that in a large cluster it could actually happen that Marathon will take longer than 10 seconds to send the first bytes in it's response. Especially, when the server is under a high load at this point in time. In order to be able to serve all users of Traefik I think we should make the timeouts configurable and aim for a high default value like ~ 60 seconds for the ResponseHeaderTimeout. For the TLSHandshake I would stick with 5 seoncds as default and also make it configurable. Sounds good to you?
  2. I also think we should stick to master.

@timoreimann
Copy link
Contributor

Sounds reasonable on both fronts. 👍

@m3co-code m3co-code force-pushed the sane-marathon-connection-timeouts branch from f1f6db5 to c8f7ccd Compare May 14, 2018 13:24
@m3co-code m3co-code changed the title sane Marathon request timeouts sane and configurable Marathon request timeouts May 14, 2018
@m3co-code m3co-code changed the title sane and configurable Marathon request timeouts sane default and configurable Marathon request timeouts May 14, 2018
@m3co-code
Copy link
Contributor Author

I updated the PR accordingly. PTAL.

@ldez ldez added kind/enhancement a new or improved feature. and removed bot/no-merge kind/bug/fix a bug fix labels May 14, 2018
@@ -55,7 +55,9 @@ type Provider struct {
MarathonLBCompatibility bool `description:"Add compatibility with marathon-lb labels" export:"true"`
FilterMarathonConstraints bool `description:"Enable use of Marathon constraints in constraint filtering" export:"true"`
TLS *types.ClientTLS `description:"Enable TLS support" export:"true"`
DialerTimeout flaeg.Duration `description:"Set a non-default connection timeout for Marathon" export:"true"`
DialerTimeout flaeg.Duration `description:"Set a non-default dialer timeout for Marathon" export:"true"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to use the phrase "non-default"? Isn't it kind of assumed that defaults will be used unless specified?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks! I removed the "non-default".

Copy link
Contributor

@dtomcej dtomcej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
:shipit:

Copy link
Member

@juliens juliens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@timoreimann timoreimann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

A dial timeout of 60 seconds is overly excessive for a DNS request and
probably as good as no timeout at all. Therefore, I changed the default
value to 5 seconds as this is more reasonable.
The new timeout values are matching the one that go-marathon would set
by itself for the default HTTP client that it uses for SSE
subscriptions.
@traefiker traefiker force-pushed the sane-marathon-connection-timeouts branch from e0b2db3 to 86e865f Compare May 22, 2018 20:36
@traefiker traefiker merged commit 085593b into traefik:master May 22, 2018
@m3co-code m3co-code deleted the sane-marathon-connection-timeouts branch May 23, 2018 07:26
@mmatur mmatur changed the title sane default and configurable Marathon request timeouts Sane default and configurable Marathon request timeouts Jul 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants