What version of Go are you using (go version)?
$ go version
go version go1.16.3 linux/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env)?
go env Output
$ go env
What did you do?
In our production environment, we use tls to communicate between applications. A client application will access dozens to thousands of server applications, and server applications will have dozens to thousands of machines.
Each machine will maintain one or two long TCP connections for communication. A client may have tens of thousands of tls connections, and each connection will save a copy of the server's x509 certificate information, resulting in a large amount of memory usage.
For the same server application, the certificates held are the same. The actual number of different certificates is much lower than the number of connections, but the same size of memory is still allocated for each connection in the memory.
For the mtls(Mutual TLS) scenario, the server's tls connection may also save the client's certificate, which will cause the same memory consumption, and the number of client certificates is also much lower than the number of client connections.
What did you expect to see?
The same x509 certificate is reused through caching, and memory is no longer calculated and allocated separately for each connection, which reduces the memory usage.
What did you see instead?
Each connection will parse and save the x509 certificate information, which takes up a lot of memory.
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
In our production environment, we use tls to communicate between applications. A client application will access dozens to thousands of server applications, and server applications will have dozens to thousands of machines.
Each machine will maintain one or two long TCP connections for communication. A client may have tens of thousands of tls connections, and each connection will save a copy of the server's x509 certificate information, resulting in a large amount of memory usage.
For the same server application, the certificates held are the same. The actual number of different certificates is much lower than the number of connections, but the same size of memory is still allocated for each connection in the memory.
For the mtls(Mutual TLS) scenario, the server's tls connection may also save the client's certificate, which will cause the same memory consumption, and the number of client certificates is also much lower than the number of client connections.
What did you expect to see?
The same x509 certificate is reused through caching, and memory is no longer calculated and allocated separately for each connection, which reduces the memory usage.
What did you see instead?
Each connection will parse and save the x509 certificate information, which takes up a lot of memory.