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有哪些重大改進?


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM