So I was investigating how to reduce the memory consumption of an ssl connection, and my findings go more or less this way: ssl starts a tls_dyn_connection_sup supervisor, which starts a receiver and a sender process for the ssl flow. Now, ssl:handshake/3 accepts a hibernate_after option, which is passed to the underlying gen behaviour, but tls_dyn_connection_sup does not get such flag, even though it is too a gen_server under the hood, and just as often it might not be needed entirely.
I was tracing this process and manually running a garbage collection under the hood and memory would usually go from 6KB to 3KB, so when I have like 1M ssl connections, that diff can give me a 3GB memory saving.
But tls_dyn_connection_sup doesn’t get such hibernation flag because the supervisor API doesn’t provide a way to give it to begin with. So maybe it could be useful to give to supervisors a new start_link/4 function just like gen_servers do? And so then the ssl app can pass it to the dynamic supervisor too ![]()