1. 26 May, 2017 3 commits
    • David Lazar's avatar
      http2: fix typo in comment · 06b2bf2f
      David Lazar authored
      Change-Id: I0febb967cf55118693952332bbb6f740616cfd39
      Reviewed-on: https://go-review.googlesource.com/44271
      Run-TryBot: David Lazar <lazard@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      06b2bf2f
    • Mikio Hara's avatar
      internal/socket: add message IO functionality · b8b13433
      Mikio Hara authored
      This change adds portable message IO methods of Conn, IO message and
      control message types, and parse methods for the types to provide
      those functionality to the ipv4 and ipv6 packages.
      
      With this change, the ipv4 and ipv6 packages can provide low-level
      (but less heap allocation and the cost of invoking system calls) API
      such as read and write operations for a batch of IO messages.
      
      On vanilla linux/amd64 virtual machine:
      BenchmarkUDP/Iter-1-2            1000000              8068 ns/op             408 B/op         14 allocs/op
      BenchmarkUDP/Batch-1-2           1000000              8610 ns/op             440 B/op         14 allocs/op
      BenchmarkUDP/Iter-2-2             500000             15390 ns/op             816 B/op         28 allocs/op
      BenchmarkUDP/Batch-2-2            500000             12715 ns/op             696 B/op         20 allocs/op
      BenchmarkUDP/Iter-4-2             200000             30763 ns/op            1632 B/op         56 allocs/op
      BenchmarkUDP/Batch-4-2            300000             21853 ns/op            1216 B/op         32 allocs/op
      BenchmarkUDP/Iter-8-2             100000             61460 ns/op            3264 B/op        112 allocs/op
      BenchmarkUDP/Batch-8-2            200000             39048 ns/op            2256 B/op         56 allocs/op
      BenchmarkUDP/Iter-16-2             50000            122408 ns/op            6528 B/op        224 allocs/op
      BenchmarkUDP/Batch-16-2           100000             72728 ns/op            4336 B/op        104 allocs/op
      BenchmarkUDP/Iter-32-2             30000            243137 ns/op           13056 B/op        448 allocs/op
      BenchmarkUDP/Batch-32-2            50000            141332 ns/op            8496 B/op        200 allocs/op
      BenchmarkUDP/Iter-64-2             20000            488125 ns/op           26112 B/op        896 allocs/op
      BenchmarkUDP/Batch-64-2            30000            282078 ns/op           16816 B/op        392 allocs/op
      BenchmarkUDP/Iter-128-2            10000            973752 ns/op           52224 B/op       1792 allocs/op
      BenchmarkUDP/Batch-128-2           10000            551021 ns/op           33456 B/op        776 allocs/op
      BenchmarkUDP/Iter-256-2             3000           1977852 ns/op          104448 B/op       3584 allocs/op
      BenchmarkUDP/Batch-256-2           10000           1252596 ns/op           66736 B/op       1544 allocs/op
      BenchmarkUDP/Iter-512-2             2000           4147495 ns/op          208896 B/op       7168 allocs/op
      BenchmarkUDP/Batch-512-2            3000           2175774 ns/op          121128 B/op       2612 allocs/op
      
      Change-Id: I3e08b28917b62dbea7936a86acb24e25ccaf5365
      Reviewed-on: https://go-review.googlesource.com/38212
      Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      b8b13433
    • Mikio Hara's avatar
      internal/socket: add platform-dependent boilerplate files · f61a7739
      Mikio Hara authored
      Change-Id: I951a1abc36083401d183d61c58a8186b5ce41c6c
      Reviewed-on: https://go-review.googlesource.com/38211Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      f61a7739
  2. 25 May, 2017 1 commit
  3. 24 May, 2017 9 commits
  4. 23 May, 2017 1 commit
  5. 22 May, 2017 3 commits
  6. 17 May, 2017 1 commit
  7. 15 May, 2017 1 commit
    • Brad Fitzpatrick's avatar
      http2: reduce the number of select cases in serverConn.server · 34057069
      Brad Fitzpatrick authored
      This drops the number of select cases in serverConn.server from 10 to
      6. It was 7 in Go 1.7. It increased to 10 in Go 1.8.
      
      * replace testing-only testHookCh with always-on grab-bag serveMsgCh
        to be used for both test purposes, and infrequently used message
        types
      
      * remove the settingsTimer.C case for the initial settings timer
        and use serveMsgCh and time.AfterFunc instead
      
      * ... and do the same for the idle timeout timer.
      
      * ... and for the shutdown timer.
      
      * remove wantStartPushCh and just send the *startPushRequest to
        serveMsgCh too
      
      I could go further with this (and plan to, later), but these are the
      safe and easy ones that don't require more work elsewhere.
      
      The speed gets better the more the request/response go via the
      serverConn.serve loop. (once per Request.Body.Read or
      ResponseWriter.Flush):
      
        name            old time/op    new time/op  delta
        ServerGets-4    138µs ± 3%     134µs ± 2%   -2.54%   (p=0.002 n=10+10)
        ServerPosts-4   176µs ±27%     154µs ± 2%   -12.62%  (p=0.011 n=10+10)
      
      Updates kubernetes/kubernetes#45216
      Updates golang/go#20302
      
      Change-Id: I18019554089d7e3d76355d7137b5957e9597e803
      Reviewed-on: https://go-review.googlesource.com/43034
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarTom Bergan <tombergan@google.com>
      34057069
  8. 13 May, 2017 1 commit
    • Tom Bergan's avatar
      http2: fix lock contention slowdown due to gracefulShutdownCh · 84f0e6f9
      Tom Bergan authored
      gracefulShutdownCh is shared by all connections in a server. When a
      server accumulates many connections (e.g., 5000 in the kubemark-5000
      benchmark), we have 5000 serverConn.serve goroutines selecting on this
      channel. This means 5000 goroutines hammer the channel's lock, which
      causes severe lock contention.
      
      The fix in this CL is to make a local proxy for gracefulShutdownCh in
      each connection so that each connection selects on gracefulShutdownCh
      at most once per connection rather than once per serverConn.serve loop
      iteration.
      
      This fix is intended to be backported quickly into Go 1.8.2. The
      downside of this fix is 2KB extra stack usage per connection. A better
      fix will be implemented in Go 1.9.
      
      Unfortunately, I have been unable to reproduce this problem locally.
      This fix was verified by the kubernetes team. See:
      https://github.com/kubernetes/kubernetes/issues/45216#issuecomment-300830243
      
      Updates golang/go#20302
      
      Change-Id: I19ab19268a6ccab9b6e9dffa0cfbc89b8c7d0f19
      Reviewed-on: https://go-review.googlesource.com/43455
      Run-TryBot: Tom Bergan <tombergan@google.com>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      84f0e6f9
  9. 10 May, 2017 1 commit
    • Todd Neal's avatar
      http2/hpack: move initialization to a static table · c9b681d3
      Todd Neal authored
      This shrinks a binary that just does an http.ListenAndServe by about
      90kb due to using less code for the static array.
      
       syms
       delta   name                                                old-size  new-size  pct-difference
      -54206   vendor/golang_org/x/net/http2/hpack.newStaticTable  55233     1027      -98.14%
      -4744    runtime.pclntab                                     1041055   1036311   -0.46%
      -204     runtime.findfunctab                                 10675     10471     -1.91%
      8        runtime.typelink                                    9852      9860      0.08%
      41       runtime.gcbss                                       869       910       4.72%
      11711    vendor/golang_org/x/net/http2/hpack.init            572       12283     2047.38%
      
       sections
       delta   name             old-size  new-size  pct-difference
      -41888   .text            2185840   2143952   -1.92%
      -37644   .rodata          842131    804487    -4.47%
      -4744    .gopclntab       1041055   1036311   -0.46%
      -3343    .debug_info      981995    978652    -0.34%
      -2931    .debug_line      291295    288364    -1.01%
      8        .typelink        9852      9860      0.08%
      59       .debug_pubnames  81986     82045     0.07%
      96       .symtab          186312    186408    0.05%
      113      .debug_pubtypes  137500    137613    0.08%
      128      .debug_frame     219140    219268    0.06%
      220      .strtab          217109    217329    0.10%
      2464     .bss             127752    130216    1.93%
      
      Updates golang/go#6853
      
      Change-Id: I3383e63300585539507b75faac1072264d8f37e7
      Reviewed-on: https://go-review.googlesource.com/43090Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      c9b681d3
  10. 09 May, 2017 1 commit
  11. 03 May, 2017 1 commit
  12. 02 May, 2017 1 commit
    • Martin Probst's avatar
      xsrftoken: panic for unsafe zero length keys · 0819898f
      Martin Probst authored
      Passing a zero length key (or secret) gives no safety against XSRF
      attacks. This is a relatively easy mistake to make, e.g. by passing
      `make([]byte, 0, 1024)` to `rand.Read` instead of `make([]byte, 1024)`,
      and currently fails open, silently.
      
      This uses panic, as the API does not allow returning a structured error,
      and catching this programming error is not worth breaking API
      compatibility. Passing a zero length secret is also not an error
      condition that API callers would handle, so there is little value in
      returning a proper error.
      
      Change-Id: Ib6457347675872188d51d2a220eee4b67900f79e
      Reviewed-on: https://go-review.googlesource.com/42411Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      0819898f
  13. 24 Apr, 2017 2 commits
  14. 23 Apr, 2017 1 commit
  15. 21 Apr, 2017 2 commits
  16. 13 Apr, 2017 1 commit
  17. 06 Apr, 2017 1 commit
  18. 29 Mar, 2017 2 commits
  19. 28 Mar, 2017 2 commits
  20. 24 Mar, 2017 2 commits
  21. 23 Mar, 2017 1 commit
  22. 08 Mar, 2017 2 commits