How cloudwego/kitex-benchmark works
• Code generation for stubs
• Per-protocol server implementations
• Per-protocol client harnesses
• A shared runner/profiling library
• Orchestration scripts that build, launch, measure, and report
Main components
a. CodeGen Module (codec/protobuf, codec/thrift)
b. Service Implementations (generic/, grpc/, protobuf/, thrift/, streaming/) – each contains a server
c. Client Harnesses (under each service folder’s client/ subdirectory)
d. Runner & Profiling Core (runner/, perf/) – implements pool, limiter, timer, pprof endpoints
e. Orchestration Scripts (scripts/) – build, launch servers/clients, collect metrics, generate reports
f. Reporting & Output (output/, scripts/reports/, docs/images/)
Relationships and data flows
• Build flow
– Scripts → invoke gen_code.sh → produce generated stubs → compile server & client binaries
• Execution flow
– Scripts → start multiple server services (each on its assigned port)
– Scripts → start client processes, which use the runner library to dispatch RPC calls over loopback or network
• Profiling flow
– Servers & clients expose /debug/pprof endpoints via perf/
– Scripts or manual pprof tools attach to these ports for CPU/memory profiles
• Reporting flow
– Scripts gather raw logs into output/*.log → transform to *.csv via reports/to_csv.sh → render graphs via render_images.py
Architectural patterns
– Modular, directory-per-protocol pattern
– Shared core library (runner & perf) reused across all services & clients
– Script-driven orchestration: clear separation of build, run, measure, report
– Grouping by transport protocol + message protocol
Details
– Label ports (8000–8005 for various services, 18888 for client pprof)
– Denote network boundary (loopback vs. cross-node) if illustrating external-network mode