MXS-1823 Replace meaningless eventq info with meaningful

The evq_length file held the returned number of descriptors from
the last epoll_wait() call. As such it is highly temporal and not
particularly meaningful.

That has now been removed and the instead the average number of
returned descriptors is maintained. That information changes slowly
and thus carries some meaning.
This commit is contained in:
Johan Wikman
2018-06-28 11:56:55 +03:00
parent d339b89990
commit c89bdb9626
6 changed files with 28 additions and 13 deletions

View File

@ -33,7 +33,7 @@ typedef enum
POLL_STAT_ERROR, POLL_STAT_ERROR,
POLL_STAT_HANGUP, POLL_STAT_HANGUP,
POLL_STAT_ACCEPT, POLL_STAT_ACCEPT,
POLL_STAT_EVQ_LEN, POLL_STAT_EVQ_AVG,
POLL_STAT_EVQ_MAX, POLL_STAT_EVQ_MAX,
POLL_STAT_MAX_QTIME, POLL_STAT_MAX_QTIME,
POLL_STAT_MAX_EXECTIME POLL_STAT_MAX_EXECTIME

View File

@ -50,7 +50,7 @@ struct WORKER_STATISTICS
int64_t n_pollev; /*< Number of polls returning events */ int64_t n_pollev; /*< Number of polls returning events */
int64_t n_nbpollev; /*< Number of polls returning events */ int64_t n_nbpollev; /*< Number of polls returning events */
int64_t n_fds[MAXNFDS]; /*< Number of wakeups with particular n_fds value */ int64_t n_fds[MAXNFDS]; /*< Number of wakeups with particular n_fds value */
int64_t evq_length; /*< Event queue length */ int64_t evq_avg; /*< Average event queue length */
int64_t evq_max; /*< Maximum event queue length */ int64_t evq_max; /*< Maximum event queue length */
int64_t blockingpolls; /*< Number of epoll_waits with a timeout specified */ int64_t blockingpolls; /*< Number of epoll_waits with a timeout specified */
uint32_t qtimes[N_QUEUE_TIMES + 1]; uint32_t qtimes[N_QUEUE_TIMES + 1];

View File

@ -117,8 +117,7 @@ dprintPollStats(DCB *dcb)
dcb_printf(dcb, "No. of error events: %" PRId64 "\n", s.n_error); dcb_printf(dcb, "No. of error events: %" PRId64 "\n", s.n_error);
dcb_printf(dcb, "No. of hangup events: %" PRId64 "\n", s.n_hup); dcb_printf(dcb, "No. of hangup events: %" PRId64 "\n", s.n_hup);
dcb_printf(dcb, "No. of accept events: %" PRId64 "\n", s.n_accept); dcb_printf(dcb, "No. of accept events: %" PRId64 "\n", s.n_accept);
dcb_printf(dcb, "Total event queue length: %" PRId64 "\n", s.evq_length); dcb_printf(dcb, "Average event queue length: %" PRId64 "\n", s.evq_avg);
dcb_printf(dcb, "Average event queue length: %" PRId64 "\n", s.evq_length);
dcb_printf(dcb, "Maximum event queue length: %" PRId64 "\n", s.evq_max); dcb_printf(dcb, "Maximum event queue length: %" PRId64 "\n", s.evq_max);
dcb_printf(dcb, "No of poll completions with descriptors\n"); dcb_printf(dcb, "No of poll completions with descriptors\n");
@ -203,7 +202,7 @@ dShowEventStats(DCB *pdcb)
dcb_printf(pdcb, "Maximum queue time: %3" PRId64 "00ms\n", s.maxqtime); dcb_printf(pdcb, "Maximum queue time: %3" PRId64 "00ms\n", s.maxqtime);
dcb_printf(pdcb, "Maximum execution time: %3" PRId64 "00ms\n", s.maxexectime); dcb_printf(pdcb, "Maximum execution time: %3" PRId64 "00ms\n", s.maxexectime);
dcb_printf(pdcb, "Maximum event queue length: %3" PRId64 "\n", s.evq_max); dcb_printf(pdcb, "Maximum event queue length: %3" PRId64 "\n", s.evq_max);
dcb_printf(pdcb, "Average event queue length: %3" PRId64 "\n", s.evq_length); dcb_printf(pdcb, "Average event queue length: %3" PRId64 "\n", s.evq_avg);
dcb_printf(pdcb, "\n"); dcb_printf(pdcb, "\n");
dcb_printf(pdcb, " | Number of events\n"); dcb_printf(pdcb, " | Number of events\n");
dcb_printf(pdcb, "Duration | Queued | Executed\n"); dcb_printf(pdcb, "Duration | Queued | Executed\n");

View File

@ -764,7 +764,7 @@ Worker::STATISTICS RoutingWorker::get_statistics()
cs.n_polls = one_stats_get(&STATISTICS::n_polls, TS_STATS_SUM); cs.n_polls = one_stats_get(&STATISTICS::n_polls, TS_STATS_SUM);
cs.n_pollev = one_stats_get(&STATISTICS::n_pollev, TS_STATS_SUM); cs.n_pollev = one_stats_get(&STATISTICS::n_pollev, TS_STATS_SUM);
cs.n_nbpollev = one_stats_get(&STATISTICS::n_nbpollev, TS_STATS_SUM); cs.n_nbpollev = one_stats_get(&STATISTICS::n_nbpollev, TS_STATS_SUM);
cs.evq_length = one_stats_get(&STATISTICS::evq_length, TS_STATS_AVG); cs.evq_avg = one_stats_get(&STATISTICS::evq_avg, TS_STATS_AVG);
cs.evq_max = one_stats_get(&STATISTICS::evq_max, TS_STATS_MAX); cs.evq_max = one_stats_get(&STATISTICS::evq_max, TS_STATS_MAX);
cs.blockingpolls = one_stats_get(&STATISTICS::blockingpolls, TS_STATS_SUM); cs.blockingpolls = one_stats_get(&STATISTICS::blockingpolls, TS_STATS_SUM);
cs.maxqtime = one_stats_get(&STATISTICS::maxqtime, TS_STATS_MAX); cs.maxqtime = one_stats_get(&STATISTICS::maxqtime, TS_STATS_MAX);
@ -836,8 +836,8 @@ int64_t RoutingWorker::get_one_statistic(POLL_STAT what)
approach = TS_STATS_SUM; approach = TS_STATS_SUM;
break; break;
case POLL_STAT_EVQ_LEN: case POLL_STAT_EVQ_AVG:
member = &Worker::STATISTICS::evq_length; member = &Worker::STATISTICS::evq_avg;
approach = TS_STATS_AVG; approach = TS_STATS_AVG;
break; break;
@ -937,7 +937,9 @@ public:
json_object_set_new(pStats, "hangups", json_integer(s.n_hup)); json_object_set_new(pStats, "hangups", json_integer(s.n_hup));
json_object_set_new(pStats, "accepts", json_integer(s.n_accept)); json_object_set_new(pStats, "accepts", json_integer(s.n_accept));
json_object_set_new(pStats, "blocking_polls", json_integer(s.blockingpolls)); json_object_set_new(pStats, "blocking_polls", json_integer(s.blockingpolls));
json_object_set_new(pStats, "event_queue_length", json_integer(s.evq_length)); // TODO: When REST-API v2 is published, remove 'event_queue_length'.
json_object_set_new(pStats, "event_queue_length", json_integer(s.evq_avg));
json_object_set_new(pStats, "avg_event_queue_length", json_integer(s.evq_avg));
json_object_set_new(pStats, "max_event_queue_length", json_integer(s.evq_max)); json_object_set_new(pStats, "max_event_queue_length", json_integer(s.evq_max));
json_object_set_new(pStats, "max_exec_time", json_integer(s.maxexectime)); json_object_set_new(pStats, "max_exec_time", json_integer(s.maxexectime));
json_object_set_new(pStats, "max_queue_time", json_integer(s.maxqtime)); json_object_set_new(pStats, "max_queue_time", json_integer(s.maxqtime));

View File

@ -689,6 +689,9 @@ void Worker::poll_waitevents()
m_load.reset(); m_load.reset();
int64_t nFds_total = 0;
int64_t nPolls_effective = 0;
while (!should_shutdown()) while (!should_shutdown())
{ {
int nfds; int nfds;
@ -724,7 +727,18 @@ void Worker::poll_waitevents()
if (nfds > 0) if (nfds > 0)
{ {
m_statistics.evq_length = nfds; nPolls_effective += 1;
nFds_total += nfds;
if (nFds_total <= 0)
{
// Wrapped, so we reset the situation.
nFds_total = nfds;
nPolls_effective = 1;
}
m_statistics.evq_avg = nFds_total / nPolls_effective;
if (nfds > m_statistics.evq_max) if (nfds > m_statistics.evq_max)
{ {
m_statistics.evq_max = nfds; m_statistics.evq_max = nfds;

View File

@ -1057,9 +1057,9 @@ maxinfo_accept_events()
* Interface to poll stats for event queue length * Interface to poll stats for event queue length
*/ */
static int64_t static int64_t
maxinfo_event_queue_length() maxinfo_avg_event_queue_length()
{ {
return poll_get_stat(POLL_STAT_EVQ_LEN); return poll_get_stat(POLL_STAT_EVQ_AVG);
} }
/** /**
@ -1115,7 +1115,7 @@ static struct
{ "Hangup_events", VT_INT, (STATSFUNC)maxinfo_hangup_events }, { "Hangup_events", VT_INT, (STATSFUNC)maxinfo_hangup_events },
{ "Error_events", VT_INT, (STATSFUNC)maxinfo_error_events }, { "Error_events", VT_INT, (STATSFUNC)maxinfo_error_events },
{ "Accept_events", VT_INT, (STATSFUNC)maxinfo_accept_events }, { "Accept_events", VT_INT, (STATSFUNC)maxinfo_accept_events },
{ "Event_queue_length", VT_INT, (STATSFUNC)maxinfo_event_queue_length }, { "Avg_event_queue_length", VT_INT, (STATSFUNC)maxinfo_avg_event_queue_length },
{ "Max_event_queue_length", VT_INT, (STATSFUNC)maxinfo_max_event_queue_length }, { "Max_event_queue_length", VT_INT, (STATSFUNC)maxinfo_max_event_queue_length },
{ "Max_event_queue_time", VT_INT, (STATSFUNC)maxinfo_max_event_queue_time }, { "Max_event_queue_time", VT_INT, (STATSFUNC)maxinfo_max_event_queue_time },
{ "Max_event_execution_time", VT_INT, (STATSFUNC)maxinfo_max_event_exec_time }, { "Max_event_execution_time", VT_INT, (STATSFUNC)maxinfo_max_event_exec_time },