Giter Club home page Giter Club logo

rpcx's Introduction

Official site: http://rpcx.site

License GoDoc travis Go Report Card coveralls QQ群 sourcegraph

Notice: You can write clients in any programming languages to call rpcx services via rpcx-gateway

Installation

install the basic features:

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

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

go get -u -v -tags "reuseport quic kcp zookeeper etcd consul ping" github.com/smallnest/rpcx/...

tags:

  • quic: support quic transport
  • kcp: support kcp transport
  • zookeeper: support zookeeper register
  • etcd: support etcd register
  • consul: support consul register
  • ping: support network quality load balancing
  • reuseport: support reuseport

Features

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

rpcx 3.0 has been refactored for targets:

  1. Simple: easy to learn, easy to develop, easy to intergate and easy to deploy
  2. Performance: high perforamnce (>= grpc-go)
  3. Cross-platform: support raw slice of bytes, JSON, Protobuf and MessagePack. Theoretically it can be use in 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

  • Support raw Go functions,. No need to define proto files.
  • Pluggable. Features can be extended such as service discovery, tracing.
  • Support TCP, HTTP, QUIC and KCP
  • Support multiple codecs such as JSON、ProtobufMessagePack and raw bytes.
  • Service discovery. Support peer2peer, configured peers, zookeeper, etcd, consul and mDNS.
  • Fault tolerance:Failover、Failfast、Failtry.
  • Load banlancing:support Random, RoundRobin, Consistent hashing, Weighted, network quality and Geography.
  • Support Compression.
  • Support passing metadata.
  • Support Authorization.
  • Support heartbeat and one-way request.
  • Other features: metrics, log, timeout, alias, CircuitBreaker.
  • Support bidirectional communication.
  • Support access via HTTP so you can write clients in any programming languages
  • Support API gateway.
  • Support backup request, forking and broadcast.

rpcx uses a binary protocol and platform-independent, that 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 Environment

  • CPU: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz, 32 cores
  • Memory: 32G
  • Go: 1.9.0
  • OS: CentOS 7 / 3.10.0-229.el7.x86_64

Use

  • protobuf
  • one machine for the client and the server
  • 581 bytes payload
  • 5000 concurrent clients

Test Result

rpcx grpc-go
TPS 192300 request/second 106886 request/second
Mean latency 25 ms 46 ms
Median latency 12 ms 41 ms
P99 246ms 170ms

Examples

You can find all examples at rpcx-ecosystem/rpcx-examples3.

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 := 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)

Productions

  • Cluster defense project: 4 billion of calls per day (2 server, 8 clients)
  • Storm of the Three Kingdoms: game
  • 车弹趣
  • 撩车友
  • 迈布

If you or your company is using rpcx, welcome to tell me and I will add more in this.

Contribute

see contributors.

Welcome to contribute:

  • submit issues or requirements
  • send PRs
  • write projects to use rpcx
  • write tutorials or articles to introduce rpcx

License

Apache License, Version 2.0

rpcx's People

Contributors

phachon avatar smallnest avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.