tags:
- ready
- online
- reviewed
- microservices
- go
- frameworks
rpcx
Contents
__Roadmap info from [ roadmap website ] (https://roadmap.sh/golang/go-microservices/rpcx) __
Rpcx
Rpcx is a RPC (Remote Procedure Call) framework like Alibaba Dubbo and Weibo Motan.Some of the advantages on using Rpcx:
- Simple: easy to learn, easy to develop, easy to integrate and easy to deploy
- Performance: high performance (>= grpc-go)
- 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
- Service discovery and service governance: support zookeeper, etcd and consul.
Visit the following resources to learn more:
RPCx__
- Purpose: High-performance RPC framework.
- Key Features: Multiple codecs (Protobuf, JSON), plugins for service discovery, rate limiting, and tracing.
- Best For: High-performance RPC communication between services.
Example:
s := server.NewServer()
s.RegisterName("Arith", new(Arith), "")
s.Serve("tcp", ":8972")
RPCx__ - High-Performance RPC
Solution Example: Real-time Online Gaming
- Use Case: In an online multiplayer game, players’ interactions need to be communicated between game servers with low latency.
- Framework Usage: Using RPCx, game servers can handle real-time communication between players by calling remote methods with minimal delay and high performance.
- Workflow:
- A GameServer uses RPC to request updates from a central PlayerStatsService.
- The PlayerStatsService can return the latest statistics in real-time.
Example:
client := client.NewClient(client.DefaultOption)
client.Connect("tcp", "localhost:8972")
var reply int
err := client.Call(context.Background(), "GameServer.UpdatePlayerStats", &args, &reply)