]> Cypherpunks repositories - gostls13.git/commit
crypto/tls: implement dynamic record sizing
authorTom Bergan <tombergan@google.com>
Thu, 18 Feb 2016 02:20:24 +0000 (18:20 -0800)
committerAdam Langley <agl@golang.org>
Sat, 12 Mar 2016 00:47:13 +0000 (00:47 +0000)
commitae00df128d8434dd37f73123aaea09de786d0275
tree744eb3eafd619e3dab0182cc4314b557993a32b2
parent1220ac27ceb6462a7489b10b3974ae8f742f3f3c
crypto/tls: implement dynamic record sizing

Currently, if a client of crypto/tls (e.g., net/http, http2) calls
tls.Conn.Write with a 33KB buffer, that ends up writing three TLS
records: 16KB, 16KB, and 1KB. Slow clients (such as 2G phones) must
download the first 16KB record before they can decrypt the first byte.
To improve latency, it's better to send smaller TLS records. However,
sending smaller records adds overhead (more overhead bytes and more
crypto calls), which slightly hurts throughput.

A simple heuristic, implemented in this change, is to send small
records for new connections, then boost to large records after the
first 1MB has been written on the connection.

Fixes #14376

Change-Id: Ice0f6279325be6775aa55351809f88e07dd700cd
Reviewed-on: https://go-review.googlesource.com/19591
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tom Bergan <tombergan@google.com>
Reviewed-by: Adam Langley <agl@golang.org>
src/crypto/tls/common.go
src/crypto/tls/conn.go
src/crypto/tls/conn_test.go