Add persistent pool statistics
Added number of times a connection was taken from the pool as well as the availability of the pool as a percentage of connections taken from the pool.
This commit is contained in:
@ -45,10 +45,12 @@ typedef struct server_params
|
|||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int n_connections; /**< Number of connections */
|
int n_connections; /**< Number of connections */
|
||||||
int n_current; /**< Current connections */
|
int n_current; /**< Current connections */
|
||||||
int n_current_ops; /**< Current active operations */
|
int n_current_ops; /**< Current active operations */
|
||||||
int n_persistent; /**< Current persistent pool */
|
int n_persistent; /**< Current persistent pool */
|
||||||
|
uint64_t n_new_conn; /**< Times the current pool was empty */
|
||||||
|
uint64_t n_from_pool; /**< Times when a connection was available from the pool */
|
||||||
} SERVER_STATS;
|
} SERVER_STATS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -636,6 +636,7 @@ dcb_connect(SERVER *server, MXS_SESSION *session, const char *protocol)
|
|||||||
dcb->persistentstart = 0;
|
dcb->persistentstart = 0;
|
||||||
dcb->was_persistent = true;
|
dcb->was_persistent = true;
|
||||||
dcb->last_read = hkheartbeat;
|
dcb->last_read = hkheartbeat;
|
||||||
|
atomic_add_uint64(&server->stats.n_from_pool, 1);
|
||||||
return dcb;
|
return dcb;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -565,6 +565,9 @@ dprintServer(DCB *dcb, const SERVER *server)
|
|||||||
dcb_printf(dcb, "\tPersistent actual size max: %d\n", server->persistmax);
|
dcb_printf(dcb, "\tPersistent actual size max: %d\n", server->persistmax);
|
||||||
dcb_printf(dcb, "\tPersistent pool size limit: %ld\n", server->persistpoolmax);
|
dcb_printf(dcb, "\tPersistent pool size limit: %ld\n", server->persistpoolmax);
|
||||||
dcb_printf(dcb, "\tPersistent max time (secs): %ld\n", server->persistmaxtime);
|
dcb_printf(dcb, "\tPersistent max time (secs): %ld\n", server->persistmaxtime);
|
||||||
|
dcb_printf(dcb, "\tConnections taken from pool: %lu\n", server->stats.n_from_pool);
|
||||||
|
double d = (double)server->stats.n_from_pool / (double)(server->stats.n_connections + server->stats.n_from_pool + 1);
|
||||||
|
dcb_printf(dcb, "\tPool availability: %0.2lf%%\n", d * 100.0);
|
||||||
}
|
}
|
||||||
if (server->server_ssl)
|
if (server->server_ssl)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user