Performance Monitor for eXtremeDB/rt

Developers may vary real-time transaction deadline settings in order to optimise performance.

eXtremeDB/rt’s Performance Monitor provides means to observe the practical influence of this choice on a working real-time system by collecting the following connection and transaction statistics.

 

MCO_STATRT_OPEN_TRANS_COUNTOpened transactions count
MCO_STATRT_INTERRUPTED_TRANS_COUNT Count of interrupted transactions, i.e. transactions which missed the deadline
MCO_STATRT_COMMIT_COUNTCount of successfully committed transactions
MCO_STATRT_ROLLBACK_COUNTCount of rolled back transactions
MCO_STATRT_ERROR_TRANS_COUNTCount of transactions ended with error (excluding missed deadline)
MCO_STATRT_MAX_TRANS_TIMEMaximal execution time for successfully committed transactions
MCO_STATRT_TOTAL_TRANS_TIMETotal transaction time for successfully committed transactions

Statistics are collected per connection. The mechanism is lock-free and does not impose a performance penalty on transactions. However, as a side effect, it may be imprecise at some moments.

Histogram

Based on collected statistics the Performance Monitor builds a histogram showing the distribution of values across ranges. The histogram consists of ranges and bars. Ranges are time intervals (measured in eXtremeDB/rt timer_unit – system dependent unit of time). Bars show the number of transactions committed within corresponding time ranges. Ranges are calculated automatically based on transaction times, for each separate connection. The number of bars is defined by the constant MCO_STAT_HISTOGRAM_NELEMENT in the file mcostatrt.h. Its default value is 10.

Quick start (for Linux)

HTTP REST API resources

The /api Resource

The root resource api provides information about eXtremeDB/rt's version.

For example, with the REST server started (listening on port 8083), the following HTTP request will return a list with a version, revision and build:

http://0.0.0.0:8083/api

    {
      "v": "1.2",
      "rev":"",
      "type": "rt"
    }

The /api/stats resource

The api/stats resource provides access to the connection statistics. It has one parameter: agg.

/api/stats?agg=0: do not perform aggregation, return statistics for each connection.

{
	"now":1673337297594,
	"stats":[
		{
			"db":0,
			"con":[
				{
					"id":0,
					"counters":[80429482,0,80429481,0,0,820,72920655],
					"hist":{
						"r":1600,
						"v":[80429459,13,5,2,1,1,0,0,0,0]
					}
				}
			]
		}
	]
}

/api/stats?agg=1 (the default): Perform aggregation, return aggregated statistics:

{
	"now":1673337518962,
	"counters":[
		{
			"db":0,
			"values":[304731693,0,304731692,0,0,827,275837196]
		}
	],
	"hist":{
		"r":1600,
		"v":[304731623,50,12,4,2,2,0,0,0,0]
	}
}

rst resource

Reset statistics on a target side.

When rst=1 is specified, values of counters will be reset. The default is 0 (no reset). This parameter may be optionally combined with the parameter agg:

/api/stats?rst=1

C API

While the REST API is the primary method of access to the performance monitor statistics, it is also possible to access it via C API directly.


#include <include/mcostatrt.h>

/**
* @brief Get all counters as array and reset values
*
* @param vals Pointer to array to store all counter
* reset Flag if reset statistics
* @return MCO_S_OK - no errors
*/
MCOSTATRT_API MCO_RET mco_stat_get_all(mco_conn_statistics, int reset);
/*
 * @brief Get connection's statistics
 *
 * @param db_name   database name to get statistics and histogram
 *        conn_no   connection identifier to get values.  Value -1 means get aggregated values for all connections
 *        out_stats Pointer to array to store statistic counters
 *        hist      Pointer to array to store histogram
  *       reset     Flag to reset histogram
 * @return MCO_S_OK - no errors
 * @return MCO_S_NOTFOUND - connection with conn_no was not
*/


MCOSTATRT_API MCO_RET mco_stat_get_conn_stats(const char *db_name, int conn_no,
      mco_conn_statistics out_stats, mco_stat_histogram_t *hist, int reset);