MINOR: global: report information about the cost of SSL connections
An SSL connection takes some memory when it exists and during handshakes. We measured up to 16kB for an established endpoint, and up to 76 extra kB during a handshake. The SSL layer stores these values into the global struct during initialization. If other SSL libs are used, it's easy to change these values. Anyway they'll only be used as gross estimates in order to guess the max number of SSL conns that can be established when memory is constrained and the limit is not set.
This commit is contained in:
parent
fce03113fa
commit
d92aa5c44a
|
@ -247,6 +247,17 @@
|
|||
#define SSL_DEFAULT_DH_PARAM 0
|
||||
#endif
|
||||
|
||||
/* max memory cost per SSL session */
|
||||
#ifndef SSL_SESSION_MAX_COST
|
||||
#define SSL_SESSION_MAX_COST (16*1024) // measured
|
||||
#endif
|
||||
|
||||
/* max memory cost per SSL handshake (on top of session) */
|
||||
#ifndef SSL_HANDSHAKE_MAX_COST
|
||||
#define SSL_HANDSHAKE_MAX_COST (76*1024) // measured
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Number of samples used to compute the times reported in stats. A power of
|
||||
* two is highly recommended, and this value multiplied by the largest response
|
||||
* time must not overflow and unsigned int. See freq_ctr.h for more information.
|
||||
|
|
|
@ -84,6 +84,8 @@ struct global {
|
|||
int nbproc;
|
||||
int maxconn, hardmaxconn;
|
||||
int maxsslconn;
|
||||
int ssl_session_max_cost; /* how many bytes an SSL session may cost */
|
||||
int ssl_handshake_max_cost; /* how many bytes an SSL handshake may use */
|
||||
int ssl_used_frontend; /* non-zero if SSL is used in a frontend */
|
||||
int ssl_used_backend; /* non-zero if SSL is used in a backend */
|
||||
#ifdef USE_OPENSSL
|
||||
|
|
|
@ -4720,6 +4720,9 @@ static void __ssl_sock_init(void)
|
|||
bind_register_keywords(&bind_kws);
|
||||
srv_register_keywords(&srv_kws);
|
||||
cfg_register_keywords(&cfg_kws);
|
||||
|
||||
global.ssl_session_max_cost = SSL_SESSION_MAX_COST;
|
||||
global.ssl_handshake_max_cost = SSL_HANDSHAKE_MAX_COST;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue