This repository has been archived by the owner on Mar 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 140
Accelerate dead peer detection with user timeout option #202
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
// if packets are not acknowledged after 20 seconds. This is a | ||
// relatively new TCP option to improve dead peer detection. | ||
// Do not fail newHTTPClient if OS doesn's support it. | ||
SetTCPUserTimeout(tcpConn, 20*time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very familiar with this, but I'm wondering, why hard code 20s and not use timeout
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vieux It's an option. The existing timeout
is for TCP connection setup. I was thinking several options including timeout, 20s, 2 * timeout, timeout + 10s, max(timeout, 20s)
. I hesitated with timeout
because I'm afraid of aggressive user setting on timeout
. Dead peer detection shouldn't be too aggressive.
Signed-off-by: Dong Chen <dongluo.chen@docker.com>
LGTM ping @ehazlett |
LGTM |
ehazlett
added a commit
that referenced
this pull request
Jan 12, 2016
Accelerate dead peer detection with user timeout option
This was referenced Jan 13, 2016
dongluochen
added a commit
to dongluochen/dockerclient
that referenced
this pull request
Jan 13, 2016
vieux
added a commit
that referenced
this pull request
Jan 14, 2016
Revert "Merge pull request #202 from dongluochen/supportTcpUserTimeout"
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Dockerclient are used by other tools like swarm. Swarm manager normally maintains 2-6 established TCP connections with an engine thru HTTP keepalive. When an engine goes offline abruptly, like engine crash, host pause, network failure, these connections remain in
Established
state. By default swarm manager relies on system dead connection detection mechanism to fail requests. In typical Linux system it's around 13-20 minutes, depending on tcp_retries1, tcp_retries2 and retransmit timeout value. From user perspective, docker CLI hangs.RFC5482 defines TCP_USER_TIMEOUT so a sender can break the connection faster. While Golang doesn't support this socket option. Linux and Windows have different options to support user timeout.
Signed-off-by: Dong Chen dongluo.chen@docker.com