Skip to content

Speed Test

Implementation file: rpc_speed.go

Implement bidirectional RPC speed test: verify test parameters, send and receive binary frames of specified length, count uplink and downlink bytes and time consumption, and calculate Mbps.

This capability is used to test the RPC/DataChannel data path and does not represent a guarantee of business throughput.

Core structure and main function

SymbolFunction
SpeedTestResultStores uplink and downlink statistics and test time consumption.
SpeedTestResult.UpMbps / DownMbpsCalculate upstream and downstream Mbps.
callRPCSpeedTestClient-side speed test process.
handleSpeedTestServer-side speed test streaming handler.
validateSpeedTestRequestVerify the uplink and downlink length and test parameters.
writeBinaryFrames / readBinaryFramesWrite or read binary frames of the specified total length.
mbpsCalculate Mbps based on the number of bytes and time taken.