diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-02-14 22:24:38 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-02-14 22:24:38 -0800 |
| commit | c7ac94ea9a3bc2842ce41c1fcad6fc23781c1296 (patch) | |
| tree | a311bf1155c110610519186113889f8943407193 /weed/operation/grpc_client.go | |
| parent | be415f4e3c5ddb96577ae5e0fd86e612f6122078 (diff) | |
| download | seaweedfs-c7ac94ea9a3bc2842ce41c1fcad6fc23781c1296.tar.xz seaweedfs-c7ac94ea9a3bc2842ce41c1fcad6fc23781c1296.zip | |
skip EOF message
now tcp
Concurrency Level: 16
Time taken for tests: 22.963 seconds
Complete requests: 1048576
Failed requests: 0
Total transferred: 1106755384 bytes
Requests per second: 45663.49 [#/sec]
Transfer rate: 47067.47 [Kbytes/sec]
vs normal
Concurrency Level: 16
Time taken for tests: 22.286 seconds
Complete requests: 1048576
Failed requests: 0
Total transferred: 1106754345 bytes
Requests per second: 47050.30 [#/sec]
Transfer rate: 48496.88 [Kbytes/sec]
Diffstat (limited to 'weed/operation/grpc_client.go')
| -rw-r--r-- | weed/operation/grpc_client.go | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/weed/operation/grpc_client.go b/weed/operation/grpc_client.go index c7a8d2ffd..6820f8696 100644 --- a/weed/operation/grpc_client.go +++ b/weed/operation/grpc_client.go @@ -66,13 +66,21 @@ func getConnection(tcpAddress string) net.Conn { pool, found := connectionPool[tcpAddress] if !found { + println("creating pool for", tcpAddress) pool = &sync.Pool{New: func() interface{} { - conn, err := net.Dial("tcp", tcpAddress) + raddr, err := net.ResolveTCPAddr("tcp", tcpAddress) + if err != nil { + glog.Fatal(err) + } + + conn, err := net.DialTCP("tcp", nil, raddr) if err != nil { glog.Errorf("failed to connect to %s: %v", tcpAddress, err) return conn } - // println("connected", tcpAddress, "=>", conn.LocalAddr().String()) + conn.SetKeepAlive(true) + conn.SetNoDelay(true) + println("connected", tcpAddress, "=>", conn.LocalAddr().String()) return conn }} connectionPool[tcpAddress] = pool @@ -88,7 +96,7 @@ func releaseConnection(conn net.Conn, tcpAddress string) { pool, found := connectionPool[tcpAddress] if !found { - // println("can not return connection", tcpAddress, "=>", conn.LocalAddr().String()) + println("can not return connection", tcpAddress, "=>", conn.LocalAddr().String()) return } pool.Put(conn) |
