quic-go测试

QUICQuick UDP Internet Connections)是基于UDP的多路复用和安全的通用传输层协议,相当于在UDP上实现了TCP+TLS+HTTP/2数据传输。

理论上quic采用UDP传输数据,封装了TLSHTTP/2HTTP3协议中,quic仅封装TLSHTTP3协议数据基于quic协议传输),首次连接加载时间为2RTT,之后重新为1RTT

QUICHTTP3的基础。目前quic协议未定稿,变动频繁。

quic-go测试示例

git clone https://gitee.com/yuxio/quic-go.git
cd quic-go/example
go build -o ser main.go
go build -o cli client/main.go

运行:

示例采用单向认证方式,证书签发的CN=localhost,不能使用IP。

 ./ser -bind ":8088" 
server GET localhost:8088/demo/tiles
server Responding with 200
server Peer closed session with error: Application error 0x100
server Connection 0xfc314d4e5df5d38b closed.
./cli https://localhost:8088/demo/tiles
GET https://localhost:8088/demo/tiles
client Starting new connection to localhost ([::]:52586 -> 127.0.0.1:8088), source connection ID (empty), destination connection ID 0xfc314d4e5df5d38b, version TLS dev version (WIP)
Got response for https://localhost:8088/demo/tiles: &http.Response{Status:"200 OK", StatusCode:200, Proto:"HTTP/3", ProtoMajor:3, ProtoMinor:0, Header:http.Header{}, Body:(*http3.body)(0xc000324a00), ContentLength:0, TransferEncoding:[]string(nil), Close:false, Uncompressed:false, Trailer:http.Header(nil), Request:(*http.Request)(nil), TLS:(*tls.ConnectionState)(nil)}
Request Body:
<html><head><style>img{width:40px;height:40px;}</style></head><body><img src="/demo/tile?cachebust=0">...<img src="/demo/tile?cachebust=199"></body></html>
client Closing session with error: Application error 0x100
client Connection 0xfc314d4e5df5d38b closed.

QUIC单向认证(22数据帧)

目前测试quic-go:同等条件下QUICHTTP2传输的数据包少,时间应该较短,目前测试效果不佳,但相差不大。大数据量、多次连接时QUIC才能体现优势。

简单测试单次链接时间:连接--发送--接收--断开
grpc_simple: 28ms
grpc_single: 44ms
grpc_dul: 51ms
http_simple: 21ms
http_single: 32ms
http_dual: 38ms
quic_single: 35ms

 

参考:

  1. Cronet网络库系列()HTTPS/HTTP2/HTTP3/QUIC/WebSocket详解

  2. 快速读懂QUIC协议

  3. 如何看待 HTTP/3

  4. HTTP/2.0 相比1.0有哪些重大改进?

posted @ 2020-03-28 10:55  yuxi_o  阅读(3873)  评论(0编辑  收藏  举报