Allenxuxu / gev

🚀Gev is a lightweight, fast non-blocking TCP network library / websocket server based on Reactor mode. Support custom protocols to quickly and easily build high-performance servers.
MIT License
1.72k stars 193 forks source link

百兆数据传输效率 #135

Open hjhsamuel opened 1 year ago

hjhsamuel commented 1 year ago

参考Example中的protobuf实例进行了初步测试,改动了proto文件: message SendMessageReq { bytes Body = 1; } message SendMessageRsp { bool Ok = 1; } 每次传递的Body数据量在百兆左右,发现每个连接在初次进行数据传输时,都存在近一分钟左右的耗时,目前怀疑是Buffer扩容的耗时导致,请教一下,针对偶尔存在百兆数据传输的业务情形下,该如何使用或者有哪些思路优化gev的数据传输效率呢?

Allenxuxu commented 1 year ago

参考Example中的protobuf实例进行了初步测试,改动了proto文件: message SendMessageReq { bytes Body = 1; } message SendMessageRsp { bool Ok = 1; } 每次传递的Body数据量在百兆左右,发现每个连接在初次进行数据传输时,都存在近一分钟左右的耗时,目前怀疑是Buffer扩容的耗时导致,请教一下,针对偶尔存在百兆数据传输的业务情形下,该如何使用或者有哪些思路优化gev的数据传输效率呢?

可以提供一些 pprof 信息吗?

lxzan commented 1 year ago

可以参考WebSocket协议, 分片传输大包