目录

SOFARPC Benchmark

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.

Modules

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)

Bolt + Hessian Benchmark

Run Benchmark

# 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

Run Profiling

./benchmark.sh -m profiling sofa-rpc-bolt-hessian-server
./benchmark.sh -m profiling sofa-rpc-bolt-hessian-client

Triple Benchmark

TripleClient 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)

Run Benchmark

# 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-client

Specify Serialization

Triple 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-client

Triple Proto Benchmark

TripleProtoClient 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)

Run Benchmark

# 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

Common Parameters

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"

Specify port, host, output file, thread count

./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

Specify JMH warmup and measurement iterations

./benchmark.sh -a "--warmupIterations=3 --warmupTime=10 --measurementIterations=3 --measurementTime=150" sofa-rpc-bolt-hessian-client

Specify request size and result format

./benchmark.sh -e "-Drequest.size=10240 -Dresult.format=TEXT" sofa-rpc-bolt-hessian-client
关于
104.0 KB
邀请码
    Gitlink(确实开源)
  • 加入我们
  • 官网邮箱:gitlink@ccf.org.cn
  • QQ群
  • QQ群
  • 公众号
  • 公众号

版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9 京公网安备 11010802032778号