From 122b16133ace9fbee4fe35b37db18f07bb0d16b2 Mon Sep 17 00:00:00 2001 From: zarzet Date: Mon, 13 Jul 2026 19:08:58 +0700 Subject: [PATCH] perf(tls): enable session resumption on the stdlib transports --- go_backend/tls_roots.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/go_backend/tls_roots.go b/go_backend/tls_roots.go index 25cc3ea2..ad38cd3b 100644 --- a/go_backend/tls_roots.go +++ b/go_backend/tls_roots.go @@ -74,9 +74,16 @@ func supplementalRootCAs() *x509.CertPool { return supplementalRootCAsPool } +// stdTLSSessionCache is shared by every stdlib transport so TLS session +// tickets enable resumption (fewer handshake round-trips) after idle-pool +// evictions and network switches. Package-level so toggling compatibility +// options does not drop accumulated sessions. +var stdTLSSessionCache = tls.NewLRUClientSessionCache(64) + func newTLSCompatibilityConfig(insecureTLS bool) *tls.Config { return &tls.Config{ RootCAs: supplementalRootCAs(), InsecureSkipVerify: insecureTLS, + ClientSessionCache: stdTLSSessionCache, } }