Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4242)

Issue 12416043: code review 12416043: net: implement TCP connection setup with fast failover (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 8 months ago by mikio
Modified:
10 years, 7 months ago
Reviewers:
rsc
CC:
golang-dev, bradfitz, ioe, rsc
Visibility:
Public.

Description

net: implement TCP connection setup with fast failover This CL adds minimal support of Happy Eyeballs-like TCP connection setup to Dialer API. Happy Eyeballs and derivation techniques are described in the following: - Happy Eyeballs: Success with Dual-Stack Hosts http://tools.ietf.org/html/rfc6555 - Analysing Dual Stack Behaviour and IPv6 Quality http://www.potaroo.net/presentations/2012-04-17-dual-stack-quality.pdf Usually, the techniques consist of three components below. - DNS query racers, that run A and AAAA queries in parallel or series - A short list of destination addresses - TCP SYN racers, that run IPv4 and IPv6 transport in parallel or series This CL implements only the latter two. The existing DNS query component gathers together A and AAAA records in series, so we don't touch it here. This CL just uses extended resolveInternetAddr and makes it possible to run multiple Dial racers in parallel. For example, when the given destination is a DNS name and the name has multiple address family A and AAAA records, and it happens on the TCP wildcard network "tcp" with DualStack=true like the following: (&net.Dialer{DualStack: true}).Dial("tcp", "www.example.com:80") The function will return a first established connection either TCP over IPv4 or TCP over IPv6, and close the other connection internally. Fixes issue 3610. Fixes issue 5267. Benchmark results on freebsd/amd64 virtual machine, tip vs. tip+12416043: benchmark old ns/op new ns/op delta BenchmarkTCP4OneShot 50696 52141 +2.85% BenchmarkTCP4OneShotTimeout 65775 66426 +0.99% BenchmarkTCP4Persistent 10986 10457 -4.82% BenchmarkTCP4PersistentTimeout 11207 10445 -6.80% BenchmarkTCP6OneShot 62009 63718 +2.76% BenchmarkTCP6OneShotTimeout 78351 79138 +1.00% BenchmarkTCP6Persistent 14695 14659 -0.24% BenchmarkTCP6PersistentTimeout 15032 14646 -2.57% BenchmarkTCP4ConcurrentReadWrite 7215 6217 -13.83% BenchmarkTCP6ConcurrentReadWrite 7528 7493 -0.46% benchmark old allocs new allocs delta BenchmarkTCP4OneShot 36 36 0.00% BenchmarkTCP4OneShotTimeout 36 36 0.00% BenchmarkTCP4Persistent 0 0 n/a% BenchmarkTCP4PersistentTimeout 0 0 n/a% BenchmarkTCP6OneShot 37 37 0.00% BenchmarkTCP6OneShotTimeout 37 37 0.00% BenchmarkTCP6Persistent 0 0 n/a% BenchmarkTCP6PersistentTimeout 0 0 n/a% BenchmarkTCP4ConcurrentReadWrite 0 0 n/a% BenchmarkTCP6ConcurrentReadWrite 0 0 n/a% benchmark old bytes new bytes delta BenchmarkTCP4OneShot 2500 2503 0.12% BenchmarkTCP4OneShotTimeout 2508 2505 -0.12% BenchmarkTCP4Persistent 0 0 n/a% BenchmarkTCP4PersistentTimeout 0 0 n/a% BenchmarkTCP6OneShot 2713 2707 -0.22% BenchmarkTCP6OneShotTimeout 2722 2720 -0.07% BenchmarkTCP6Persistent 0 0 n/a% BenchmarkTCP6PersistentTimeout 0 0 n/a% BenchmarkTCP4ConcurrentReadWrite 0 0 n/a% BenchmarkTCP6ConcurrentReadWrite 0 0 n/a%

Patch Set 1 : diff -r ad8278144324 https://code.google.com/p/go #

Patch Set 2 : diff -r ad8278144324 https://code.google.com/p/go #

Patch Set 3 : diff -r ad8278144324 https://code.google.com/p/go #

Patch Set 4 : diff -r 99056a2a8a9d https://code.google.com/p/go #

Total comments: 10

Patch Set 5 : diff -r ca6899fcb96a https://code.google.com/p/go #

Patch Set 6 : diff -r 22365bd87858 https://code.google.com/p/go #

Unified diffs Side-by-side diffs Delta from patch set Stats (+337 lines, -63 lines) Patch
M src/pkg/net/dial.go View 1 2 3 4 5 3 chunks +71 lines, -9 lines 0 comments Download
M src/pkg/net/dial_gen.go View 1 2 3 4 1 chunk +12 lines, -39 lines 0 comments Download
M src/pkg/net/dial_test.go View 1 2 3 4 5 3 chunks +137 lines, -0 lines 0 comments Download
M src/pkg/net/dialgoogle_test.go View 1 2 3 4 5 1 chunk +28 lines, -0 lines 0 comments Download
M src/pkg/net/fd_plan9.go View 1 2 3 4 1 chunk +2 lines, -2 lines 0 comments Download
M src/pkg/net/fd_unix.go View 1 2 3 4 1 chunk +2 lines, -6 lines 0 comments Download
M src/pkg/net/fd_windows.go View 1 2 3 4 1 chunk +3 lines, -7 lines 0 comments Download
A src/pkg/net/mockserver_test.go View 1 2 3 4 1 chunk +82 lines, -0 lines 0 comments Download

Messages

Total messages: 16
mikio
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://code.google.com/p/go
10 years, 7 months ago (2013-08-28 08:39:28 UTC) #1
bradfitz
This CL has gone from big to split up into multiple medium ones, back to ...
10 years, 7 months ago (2013-08-29 00:24:06 UTC) #2
mikio
On Thu, Aug 29, 2013 at 9:24 AM, Brad Fitzpatrick <bradfitz@golang.org> wrote: > This CL ...
10 years, 7 months ago (2013-08-29 00:55:53 UTC) #3
mikio
Hello golang-dev@googlegroups.com, bradfitz@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
10 years, 7 months ago (2013-08-31 02:22:31 UTC) #4
mikio
Hello golang-dev@googlegroups.com, bradfitz@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
10 years, 7 months ago (2013-08-31 02:52:09 UTC) #5
mikio
Hello golang-dev@googlegroups.com, bradfitz@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
10 years, 7 months ago (2013-09-02 07:56:55 UTC) #6
bradfitz
https://codereview.appspot.com/12416043/diff/163001/src/pkg/net/dial.go File src/pkg/net/dial.go (right): https://codereview.appspot.com/12416043/diff/163001/src/pkg/net/dial.go#newcode169 src/pkg/net/dial.go:169: // the list of addresses. It will return a ...
10 years, 7 months ago (2013-09-04 17:50:59 UTC) #7
bradfitz
I think Happy Eyeballs should probably be opt-in (off by default). You should have to ...
10 years, 7 months ago (2013-09-04 17:51:06 UTC) #8
ioe
On Wednesday, September 4, 2013 7:51:04 PM UTC+2, Brad Fitzpatrick wrote: > I think Happy ...
10 years, 7 months ago (2013-09-04 20:25:43 UTC) #9
bradfitz
On Wed, Sep 4, 2013 at 1:25 PM, Ingo Oeser <nightlyone@googlemail.com>wrote: > On Wednesday, September ...
10 years, 7 months ago (2013-09-05 00:03:13 UTC) #10
rsc
I agree with Brad. Please make this opt-in, by using something like DualStack bool // ...
10 years, 7 months ago (2013-09-06 20:31:01 UTC) #11
mikio
PTAL I named the opt-in knob "MultiAttempt" because we could use it not only for ...
10 years, 7 months ago (2013-09-10 07:43:51 UTC) #12
rsc
I think this should be DualStack, not MultiAttempt. MultiAttempt might just as well mean trying ...
10 years, 7 months ago (2013-09-10 15:42:42 UTC) #13
mikio
PTAL Changed to DualStack.
10 years, 7 months ago (2013-09-10 21:26:37 UTC) #14
rsc
LGTM Let's stop changing package net now, please.
10 years, 7 months ago (2013-09-11 14:43:29 UTC) #15
rsc
10 years, 7 months ago (2013-09-11 14:48:58 UTC) #16
*** Submitted as https://code.google.com/p/go/source/detail?r=1b195d6fe342 ***

net: implement TCP connection setup with fast failover

This CL adds minimal support of Happy Eyeballs-like TCP connection
setup to Dialer API. Happy Eyeballs and derivation techniques are
described in the following:

- Happy Eyeballs: Success with Dual-Stack Hosts
  http://tools.ietf.org/html/rfc6555

- Analysing Dual Stack Behaviour and IPv6 Quality
  http://www.potaroo.net/presentations/2012-04-17-dual-stack-quality.pdf

Usually, the techniques consist of three components below.

- DNS query racers, that run A and AAAA queries in parallel or series
- A short list of destination addresses
- TCP SYN racers, that run IPv4 and IPv6 transport in parallel or series

This CL implements only the latter two. The existing DNS query
component gathers together A and AAAA records in series, so we don't
touch it here. This CL just uses extended resolveInternetAddr and makes
it possible to run multiple Dial racers in parallel.

For example, when the given destination is a DNS name and the name has
multiple address family A and AAAA records, and it happens on the TCP
wildcard network "tcp" with DualStack=true like the following:

(&net.Dialer{DualStack: true}).Dial("tcp", "www.example.com:80")

The function will return a first established connection either TCP over
IPv4 or TCP over IPv6, and close the other connection internally.

Fixes issue 3610.
Fixes issue 5267.


Benchmark results on freebsd/amd64 virtual machine, tip vs. tip+12416043:

benchmark                           old ns/op    new ns/op    delta
BenchmarkTCP4OneShot                    50696        52141   +2.85%
BenchmarkTCP4OneShotTimeout             65775        66426   +0.99%
BenchmarkTCP4Persistent                 10986        10457   -4.82%
BenchmarkTCP4PersistentTimeout          11207        10445   -6.80%
BenchmarkTCP6OneShot                    62009        63718   +2.76%
BenchmarkTCP6OneShotTimeout             78351        79138   +1.00%
BenchmarkTCP6Persistent                 14695        14659   -0.24%
BenchmarkTCP6PersistentTimeout          15032        14646   -2.57%
BenchmarkTCP4ConcurrentReadWrite         7215         6217  -13.83%
BenchmarkTCP6ConcurrentReadWrite         7528         7493   -0.46%

benchmark                          old allocs   new allocs    delta
BenchmarkTCP4OneShot                       36           36    0.00%
BenchmarkTCP4OneShotTimeout                36           36    0.00%
BenchmarkTCP4Persistent                     0            0     n/a%
BenchmarkTCP4PersistentTimeout              0            0     n/a%
BenchmarkTCP6OneShot                       37           37    0.00%
BenchmarkTCP6OneShotTimeout                37           37    0.00%
BenchmarkTCP6Persistent                     0            0     n/a%
BenchmarkTCP6PersistentTimeout              0            0     n/a%
BenchmarkTCP4ConcurrentReadWrite            0            0     n/a%
BenchmarkTCP6ConcurrentReadWrite            0            0     n/a%

benchmark                           old bytes    new bytes    delta
BenchmarkTCP4OneShot                     2500         2503    0.12%
BenchmarkTCP4OneShotTimeout              2508         2505   -0.12%
BenchmarkTCP4Persistent                     0            0     n/a%
BenchmarkTCP4PersistentTimeout              0            0     n/a%
BenchmarkTCP6OneShot                     2713         2707   -0.22%
BenchmarkTCP6OneShotTimeout              2722         2720   -0.07%
BenchmarkTCP6Persistent                     0            0     n/a%
BenchmarkTCP6PersistentTimeout              0            0     n/a%
BenchmarkTCP4ConcurrentReadWrite            0            0     n/a%
BenchmarkTCP6ConcurrentReadWrite            0            0     n/a%

R=golang-dev, bradfitz, nightlyone, rsc
CC=golang-dev
https://codereview.appspot.com/12416043

Committer: Russ Cox <rsc@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b