When I looked at the same thing, I was profiling my application using an array when 1000 clients were connected.
- Test 1: without using SSL. Peak Memory Usage - 2.871 MB.
- Test 2: with SSL settings by default. Peak memory 617.3 MB.
- Test 3: With SSL disabled. Peak memory 41.93 MB.
- Test 4: Modified test 3 with SSL_MODE_RELEASE_BUFFERS enabled. Peak memory 11.49 MB.
This goes up to 11.5 kilobytes per connection, although of course it will be different in your application.
You are already using SSL_MODE_RELEASE_BUFFERS, but you may also consider disabling compression. Disabling compression can be achieved using the following. This requires openssl> = 1.0.
SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_COMPRESSION | <other options>);
or
SSL_set_options(ssl, SSL_OP_NO_COMPRESSION | <other options>);
source share