From 71b734c30725c15f5108f2b2aa9620eea1152a32 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Tue, 28 Jan 2014 15:19:44 +0100 Subject: [PATCH] MINOR: cli: add more information to the "show info" output In addition to previous outputs, we also emit the cumulated number of connections, the cumulated number of requests, the maximum allowed SSL connection concurrency, the current number of SSL connections and the cumulated number of SSL connections. This will help troubleshoot systems which experience memory shortage due to SSL. --- include/proto/ssl_sock.h | 3 +++ src/dumpstats.c | 17 ++++++++++++++--- src/ssl_sock.c | 5 ++++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/include/proto/ssl_sock.h b/include/proto/ssl_sock.h index 5f83dbc70..9d891d908 100644 --- a/include/proto/ssl_sock.h +++ b/include/proto/ssl_sock.h @@ -29,6 +29,9 @@ #include extern struct xprt_ops ssl_sock; +extern int sslconns; +extern int totalsslconns; + int ssl_sock_handshake(struct connection *conn, unsigned int flag); int ssl_sock_prepare_ctx(struct bind_conf *bind_conf, SSL_CTX *ctx, struct proxy *proxy); void ssl_sock_free_certs(struct bind_conf *bind_conf); diff --git a/src/dumpstats.c b/src/dumpstats.c index 40b028768..227abc546 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -2168,8 +2168,15 @@ static int stats_dump_info_to_buffer(struct stream_interface *si) "Maxsock: %d\n" "Maxconn: %d\n" "Hard_maxconn: %d\n" - "Maxpipes: %d\n" "CurrConns: %d\n" + "CumConns: %d\n" + "CumReq: %d\n" +#ifdef USE_OPENSSL + "MaxSslConns: %d\n" + "CurrSslConns: %d\n" + "CumSslConns: %d\n" +#endif + "Maxpipes: %d\n" "PipesUsed: %d\n" "PipesFree: %d\n" "ConnRate: %d\n" @@ -2195,8 +2202,12 @@ static int stats_dump_info_to_buffer(struct stream_interface *si) up, global.rlimit_memmax, global.rlimit_nofile, - global.maxsock, global.maxconn, global.hardmaxconn, global.maxpipes, - actconn, pipes_used, pipes_free, + global.maxsock, global.maxconn, global.hardmaxconn, + actconn, totalconn, global.req_count, +#ifdef USE_OPENSSL + global.maxsslconn, sslconns, totalsslconns, +#endif + global.maxpipes, pipes_used, pipes_free, read_freq_ctr(&global.conn_per_sec), global.cps_lim, global.cps_max, read_freq_ctr(&global.comp_bps_in), read_freq_ctr(&global.comp_bps_out), global.comp_rate_lim, diff --git a/src/ssl_sock.c b/src/ssl_sock.c index 31f093982..88c758b1d 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -86,7 +86,8 @@ #define SSL_SOCK_ST_TO_CAEDEPTH(s) ((s >> (6+16)) & 15) #define SSL_SOCK_ST_TO_CRTERROR(s) ((s >> (4+6+16)) & 63) -static int sslconns = 0; +int sslconns = 0; +int totalsslconns = 0; void ssl_sock_infocbk(const SSL *ssl, int where, int ret) { @@ -1129,6 +1130,7 @@ static int ssl_sock_init(struct connection *conn) conn->flags |= CO_FL_SSL_WAIT_HS | CO_FL_WAIT_L6_CONN; sslconns++; + totalsslconns++; return 0; } else if (objt_listener(conn->target)) { @@ -1151,6 +1153,7 @@ static int ssl_sock_init(struct connection *conn) conn->flags |= CO_FL_SSL_WAIT_HS | CO_FL_WAIT_L6_CONN; sslconns++; + totalsslconns++; return 0; } /* don't know how to handle such a target */