smallnest / rpcx

Best microservices framework in Go, like alibaba Dubbo, but with more features, Scale easily. Try it. Test it. If you feel it's better, use it! 𝐉𝐚𝐯𝐚有𝐝𝐮𝐛𝐛𝐨, 𝐆𝐨𝐥𝐚𝐧𝐠有𝐫𝐩𝐜𝐱! build for cloud!
https://rpcx.io
Other
8.08k stars 1.16k forks source link
dubbo grpc microservice microservices rpc service-discovery

Official site: http://rpcx.io

License GoDoc github actions Go Report Card coveralls QQ3群

Notice: etcd

since rpcx 1.7.6, some plugins have been moved to the independent project:

Announce

A tcpdump-like tool added: rpcxdump。 You can use it to debug communications between rpcx services and clients.

Cross-Languages

you can use other programming languages besides Go to access rpcx services.

If you can write Go methods, you can also write rpc services. It is so easy to write rpc applications with rpcx.

Installation

install the basic features:

go get -v github.com/smallnest/rpcx/...

If you want to use quickcp registry, use those tags to go getgo build or go run. For example, if you want to use all features, you can:

go get -v -tags "quic kcp" github.com/smallnest/rpcx/...

tags:

Which companies are using rpcx?

Features

rpcx is a RPC framework like Alibaba Dubbo and Weibo Motan.

rpcx is created for targets:

  1. Simple: easy to learn, easy to develop, easy to integrate and easy to deploy
  2. Performance: high performance (>= grpc-go)
  3. Cross-platform: support raw slice of bytes, JSON, Protobuf and MessagePack. Theoretically it can be used with java, php, python, c/c++, node.js, c# and other platforms
  4. Service discovery and service governance: support zookeeper, etcd and consul.

It contains below features

rpcx uses a binary protocol and platform-independent, which means you can develop services in other languages such as Java, python, nodejs, and you can use other prorgramming languages to invoke services developed in Go.

There is a UI manager: rpcx-ui.

Performance

Test results show rpcx has better performance than other rpc framework except standard rpc lib.

The benchmark code is at rpcx-benchmark.

Listen to others, but test by yourself.

Test Environment

Use

Test Result

mock 0ms process time

ThroughputsMean LatencyP99 Latency

mock 10ms process time

ThroughputsMean LatencyP99 Latency

mock 30ms process time

ThroughputsMean LatencyP99 Latency

Examples

You can find all examples at rpcxio/rpcx-examples.

The below is a simple example.

Server

    // define example.Arith
    ……

    s := server.NewServer()
    s.RegisterName("Arith", new(example.Arith), "")
    s.Serve("tcp", addr)

Client

    // prepare requests
    ……

    d, err := client.NewPeer2PeerDiscovery("tcp@"+addr, "")
    xclient := client.NewXClient("Arith", client.Failtry, client.RandomSelect, d, client.DefaultOption)
    defer xclient.Close()
    err = xclient.Call(context.Background(), "Mul", args, reply, nil)

Contributors

Contribute

see contributors.

Welcome to contribute:

License

Apache License, Version 2.0