Description
[Reposting from an e-mail thread]
When I was doing IoT for example, we measured that an idle HTTPS/TLS connection can suck as much as 128 KB of memory. For Gateway scenarios, where connections can be mostly idle, but they need to be there this is very expensive. If I remember correctly the problem was SSL libraries requiring a couple of 32KB or 64KB buffers no matter what.
Ideally, you want 'idle' connections to truly cost 0 Bytes of memory or very close to it.
And this is relatively simple to test, create a HTTPS server with 100,000 TLS connections doing nothing, take note of the Commit Bytes, divide by 100,000.
Do you know in .NET Core what is the cost?
A lot of that overhead is cached request structures and pipe buffers designed to make active connections faster. We could consider discarding some of those cached objects if the connection is idle for a certain period of time. What if we only held it via a weak reference when the connection was idle?