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

Issue 34580043: net: add Announcer

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 4 months ago by mikio
Modified:
9 years, 5 months ago
Reviewers:
Visibility:
Public.

Description

net: add Announcer This CL adds Announcer struct and Announce method to allow TCP listeners to run multiple duplicate TCP passive open endpoints for a performance improvement. Fixes issue 6890. Latest Linux and DragonFly BSD kernels support a TCP option called SO_REUSEPORT that resolves a typical TCP incast issue on passive open side, how to serve many to one TCP traffic efficiently, by allowing multiple TCP listeners to listen to the same pair of address and port. This approach makes server software being able to run multiple incoming TCP connection acceptors for avoiding some contention between multiple TCP workers that take incoming connections from a single TCP listener. A use case would be the following: // Each goroutine can listen to the same address:port tuple. an := &net.Announcer{LoadSharing: true} address := "192.168.0.1:5963" for i := 0; i < N; i++ { go func() { ln, err := an.Listen("tcp", address) if err != nil { // error handling } defer ln.Close() for { // Linux kernel does some sort of load sharing. c, err := ln.Accept() if err != nil { // error handling } defer c.Close() } }() } See https://github.com/torvalds/linux/commit/c617f398edd4db2b8567a28e899a88f8f574798d and http://leaf.dragonflybsd.org/~sephe/netisr_so_reuseport.txt for the detail.

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

Unified diffs Side-by-side diffs Delta from patch set Stats (+266 lines, -78 lines) Patch
M src/net/dial.go View 1 chunk +43 lines, -9 lines 0 comments Download
M src/net/ipsock_posix.go View 1 chunk +2 lines, -2 lines 0 comments Download
M src/net/sock_posix.go View 2 chunks +20 lines, -11 lines 0 comments Download
M src/net/sockopt_bsd.go View 2 chunks +5 lines, -14 lines 0 comments Download
A src/net/sockopt_dragonfly.go View 1 chunk +53 lines, -0 lines 0 comments Download
M src/net/sockopt_linux.go View 2 chunks +6 lines, -0 lines 0 comments Download
M src/net/sockopt_solaris.go View 1 chunk +4 lines, -0 lines 0 comments Download
M src/net/sockopt_stub.go View 1 chunk +4 lines, -0 lines 0 comments Download
M src/net/sockopt_windows.go View 1 chunk +4 lines, -0 lines 0 comments Download
M src/net/tcpsock_plan9.go View 2 chunks +13 lines, -3 lines 0 comments Download
M src/net/tcpsock_posix.go View 2 chunks +32 lines, -2 lines 0 comments Download
M src/net/unixsock_plan9.go View 2 chunks +12 lines, -4 lines 0 comments Download
M src/net/unixsock_posix.go View 10 chunks +68 lines, -33 lines 0 comments Download

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