This project focuses on benchmarking and profiling SOFARPC with different protocol and serialization options. The code and the idea behind it is inspired by Dubbo Benchmark.
| Module | Protocol | Description |
|---|---|---|
sofa-rpc-bolt-hessian-server / client |
Bolt + Hessian | JMH benchmark |
sofa-rpc-triple-pojo-server / client |
Triple (HTTP/2) | JMH benchmark, tests UserPojoService (POJO, unary + streaming) |
sofa-rpc-triple-proto-server / client |
Triple (HTTP/2) | JMH benchmark, tests IUserService (Protobuf, unary + streaming) |
# Terminal 1: start server (default port 12200)
./benchmark.sh sofa-rpc-bolt-hessian-server
# Terminal 2: start client
./benchmark.sh sofa-rpc-bolt-hessian-client./benchmark.sh -m profiling sofa-rpc-bolt-hessian-server
./benchmark.sh -m profiling sofa-rpc-bolt-hessian-clientTripleClient benchmarks all four call modes of UserPojoService:
| Benchmark | Call Mode |
|---|---|
unary |
Synchronous unary (getUser) |
serverStream |
Server streaming (listUserServerStream) |
clientStream |
Client streaming (batchCreateUserClientStream) |
biStream |
Bidirectional streaming (verifyUserBiStream) |
# Terminal 1: start server (default port 50051)
./benchmark.sh -p 50051 sofa-rpc-triple-pojo-server
# Terminal 2: start client
# Note: use 127.0.0.1 instead of localhost to avoid IPv6 proxy issues
./benchmark.sh -s 127.0.0.1 -p 50051 sofa-rpc-triple-pojo-clientTriple Pojo supports configurable serialization via -S (default: hessian2).
Both server and client must use the same serialization type.
# Use JSON serialization
./benchmark.sh -s 127.0.0.1 -p 50051 -S json sofa-rpc-triple-pojo-clientTripleProtoClient benchmarks all four call modes of IUserService using Protobuf wire format:
| Benchmark | Call Mode |
|---|---|
unary |
Synchronous unary (getUser) |
serverStream |
Server streaming (listUserServerStream) |
clientStream |
Client streaming (batchCreateUser) |
biStream |
Bidirectional streaming (verifyUserBiStream) |
# Terminal 1: start server (default port 50052)
./benchmark.sh -p 50052 sofa-rpc-triple-proto-server
# Terminal 2: start client
./benchmark.sh -s 127.0.0.1 -p 50052 sofa-rpc-triple-proto-client| Option | Description | Example |
|---|---|---|
-m |
Benchmark mode (benchmark or profiling) |
-m profiling |
-s |
Server hostname | -s 127.0.0.1 |
-p |
Server port | -p 50051 |
-f |
Output file path | -f result.json |
-t |
Client thread count | -t 64 |
-S |
Serialization type (e.g. hessian2, protobuf, json) |
-S json |
-e |
Extra system properties | -e "-Drequest.size=10240" |
-a |
Extra JMH args | -a "--warmupIterations=3" |
./benchmark.sh -p 12201 sofa-rpc-bolt-hessian-server
./benchmark.sh -s 127.0.0.1 -p 12201 -f result.json -t 64 sofa-rpc-bolt-hessian-client./benchmark.sh -a "--warmupIterations=3 --warmupTime=10 --measurementIterations=3 --measurementTime=150" sofa-rpc-bolt-hessian-client./benchmark.sh -e "-Drequest.size=10240 -Dresult.format=TEXT" sofa-rpc-bolt-hessian-client