Skip to content

Commit

Permalink
#880 support RDMA
Browse files Browse the repository at this point in the history
  • Loading branch information
smallnest committed Nov 30, 2024
1 parent 3166865 commit aa4adea
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 126 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- support io_uring
- add CacheDiscovery
- add Oneshot method for XClient
- add statsview: http://xxx.xxx.xxx.xxx:xxxx/debug/statsview
- support RDMA


## 1.8.0
Expand Down
16 changes: 9 additions & 7 deletions client/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ import (

type ConnFactoryFn func(c *Client, network, address string) (net.Conn, error)

var ConnFactories = map[string]ConnFactoryFn{
"http": newDirectHTTPConn,
"kcp": newDirectKCPConn,
"quic": newDirectQuicConn,
"unix": newDirectConn,
"memu": newMemuConn,
"iouring": newIOUringConn,
var ConnFactories = make(map[string]ConnFactoryFn)

func init() {
ConnFactories["http"] = newDirectHTTPConn
ConnFactories["kcp"] = newDirectKCPConn
ConnFactories["quic"] = newDirectQuicConn
ConnFactories["unix"] = newDirectConn
ConnFactories["memu"] = newMemuConn
ConnFactories["iouring"] = newIOUringConn
}

// Connect connects the server via specified network.
Expand Down
23 changes: 23 additions & 0 deletions client/connection_rdma.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//go:build linux
// +build linux

package client

import (
"errors"
"net"

"github.com/smallnest/rsocket"
)

func init() {
ConnFactories["rdma"] = newRDMAConn
}

func newRDMAConn(c *Client, network, address string) (net.Conn, error) {
if network != "rdma" {
return nil, errors.New("network is not rdma")
}

return rsocket.DialTCP(address)
}
66 changes: 27 additions & 39 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@
module github.com/smallnest/rpcx

go 1.21

toolchain go1.22.1
go 1.23.0

require (
github.com/akutz/memconn v0.1.0
github.com/alitto/pond v1.9.1
github.com/apache/thrift v0.20.0
github.com/alitto/pond v1.9.2
github.com/apache/thrift v0.21.0
github.com/edwingeng/doublejump v1.0.1
github.com/fatih/color v1.17.0
github.com/go-echarts/go-echarts/v2 v2.3.3
github.com/fatih/color v1.18.0
github.com/go-ping/ping v1.1.0
github.com/go-redis/redis_rate/v10 v10.0.1
github.com/godzie44/go-uring v0.0.0-20220926161041-69611e8b13d5
github.com/gogo/protobuf v1.3.2
github.com/golang/snappy v0.0.4
github.com/grandcat/zeroconf v1.0.0
github.com/hashicorp/go-multierror v1.1.1
github.com/hashicorp/golang-lru v1.0.2
github.com/jamiealquiza/tachymeter v2.0.0+incompatible
github.com/juju/ratelimit v1.0.2
github.com/julienschmidt/httprouter v1.3.0
github.com/kavu/go_reuseport v1.5.0
github.com/kr/pretty v0.2.0
github.com/quic-go/quic-go v0.45.2
github.com/quic-go/quic-go v0.48.2
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475
github.com/redis/go-redis/v9 v9.6.1
github.com/redis/go-redis/v9 v9.7.0
github.com/rpcxio/libkv v0.5.1
github.com/rs/cors v1.11.0
github.com/rs/cors v1.11.1
github.com/rubyist/circuitbreaker v2.2.1+incompatible
github.com/smallnest/quick v0.2.0
github.com/smallnest/statsview v1.0.1
github.com/smallnest/rsocket v0.0.0-20241130014235-4fb25e79490f
github.com/soheilhy/cmux v0.1.5
github.com/stretchr/testify v1.9.0
github.com/tinylib/msgp v1.2.0
github.com/twpayne/go-jsonstruct/v3 v3.0.0
github.com/tinylib/msgp v1.2.4
github.com/twpayne/go-jsonstruct/v3 v3.1.0
github.com/valyala/fastrand v1.1.0
github.com/vmihailenco/msgpack/v5 v5.4.1
github.com/xtaci/kcp-go v5.4.20+incompatible
golang.org/x/net v0.27.0
golang.org/x/sync v0.7.0
google.golang.org/protobuf v1.34.2
golang.org/x/net v0.31.0
golang.org/x/sync v0.9.0
google.golang.org/protobuf v1.35.2
)

require (
Expand All @@ -54,43 +51,34 @@ require (
github.com/fatih/camelcase v1.0.0 // indirect
github.com/fatih/structtag v1.2.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-redis/redis/v8 v8.11.5 // indirect
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect
github.com/google/pprof v0.0.0-20241128161848-dc51965c6481 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grandcat/zeroconf v1.0.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/klauspost/reedsolomon v1.12.3 // indirect
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
github.com/klauspost/reedsolomon v1.12.4 // indirect
github.com/kr/text v0.1.0 // indirect
github.com/libp2p/go-sockaddr v0.2.0 // indirect
github.com/lufia/plan9stats v0.0.0-20240513124658-fba389f38bae // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/miekg/dns v1.1.61 // indirect
github.com/onsi/ginkgo/v2 v2.19.1 // indirect
github.com/miekg/dns v1.1.62 // indirect
github.com/onsi/ginkgo/v2 v2.22.0 // indirect
github.com/peterbourgon/g2s v0.0.0-20140925154142-ec76db4c1ac1 // indirect
github.com/philhofer/fwd v1.1.3-0.20240612014219-fbbf4953d986 // indirect
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect
github.com/tjfoc/gmsm v1.4.1 // indirect
github.com/tklauser/go-sysconf v0.3.14 // indirect
github.com/tklauser/numcpus v0.8.0 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/xtaci/lossyconn v0.0.0-20200209145036-adba10fffc37 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.uber.org/mock v0.4.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.23.0 // indirect
go.uber.org/mock v0.5.0 // indirect
golang.org/x/crypto v0.29.0 // indirect
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/tools v0.27.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit aa4adea

Please sign in to comment.