Open zhiqiangxu opened 2 years ago
because we only have one shared socket for UDP
Today I made a test to compare the performance of quic/tcp/ws/http/grpc/kcp(this is the order of testcases, not the order of performance), each test sends and receives 100,000 requests/responses, all other logic is the same(they all fit into the qrpc framework), the only difference is how the raw bytes are read(each implementing net.Conn
in its own way), as you can see in the above picture, it turns out kcp is the slowest. And there's a warning saying that calling SetWriteBuffer
on a Accepted UDPSession
is invalid operation
.
The testcase for kcp is this one:https://github.com/zhiqiangxu/qrpc/blob/quic_and_kcp/test/qrpc_kcp_test.go#L80
After I tuned kcp.ListenWithOptions(address, nil, 0, 0)
to kcp.ListenWithOptions(address, nil, 7, 3)
in this commit, it still takes more than 6 seconds to finish all 100,000 requests/responses, slower than plain http
.
Any advice is very appreciated!
If
UDPSession
said to be a drop-in replacement for net.TCPConn, why isUDPSession.SetWriteBuffer
no effect if accepted from Listener?