All Products
Search
Document Center

ApsaraDB RDS:Performance Agent

Last Updated:Mar 28, 2026

Performance Agent is an AliSQL plugin that collects instance-level performance metrics at a fixed interval and stores them in a queryable in-memory table (information_schema.PERF_STATISTICS). Use it to run custom SQL queries against live performance data, build real-time dashboards in Grafana, or feed metrics into your own monitoring pipelines.

Prerequisites

Before you begin, make sure your instance meets the following version requirements:

  • MySQL 8.0 with minor engine version 20200229 or later

  • MySQL 5.7 with minor engine version 20200229 or later

  • MySQL 5.6 with minor engine version 20200630 or later

For instructions on updating the minor engine version, see Update the minor engine version of an ApsaraDB RDS for MySQL instance.

How it works

Performance Agent writes a snapshot of key performance metrics to information_schema.PERF_STATISTICS at a fixed interval (default: 1 second). The table is an in-memory structure — older entries are evicted as new ones arrive.

With the default settings (performance_agent_interval=1, performance_agent_perfstat_volume_size=3600), the table retains 3,600 rows, covering approximately the previous hour.

Data retention at a glance

Collection intervalRecords keptData retained
1 second (default)3,600 (default)~1 hour
5 seconds3,600 (default)~5 hours
10 seconds3,600 (default)~10 hours
1 second7,200~2 hours

To retain more history, increase performance_agent_perfstat_volume_size. This uses additional memory, so weigh the trade-off against your instance's available resources.

Configure Performance Agent

The following parameters control Performance Agent behavior. These parameters are not shown in the ApsaraDB RDS console. To view the current value of any parameter, run:

SHOW VARIABLES LIKE '<parameter_name>';
ParameterDescriptionDefault
performance_agent_enabledEnables or disables Performance Agent. Valid values: ON, OFF.ON
performance_agent_intervalHow often RDS collects a performance snapshot. Unit: seconds. A smaller interval means more frequent data and higher memory use.1
performance_agent_perfstat_volume_sizeMaximum number of rows in the PERF_STATISTICS table. When this limit is reached, the oldest rows are evicted.3600
performance_agent_file_sizeSize of the performance data file written to disk. Unit: MB.
performance_agent_network_devicePrefix of the physical network interface controller (NIC) name for the host.

Query performance data

All queries run against information_schema.PERF_STATISTICS. Use ORDER BY TIME DESC and LIMIT to retrieve the most recent N seconds of data.

Resource metrics (CPU, memory, I/O)

SELECT TIME, PROCS_MEM_USAGE, PROCS_CPU_RATIO
FROM information_schema.PERF_STATISTICS
ORDER BY TIME DESC
LIMIT 30;

Sample output:

+---------------------+-----------------+-----------------+
| TIME                | PROCS_MEM_USAGE | PROCS_CPU_RATIO |
+---------------------+-----------------+-----------------+
| 2020-02-27 11:15:36 |       857812992 |           18.55 |
| 2020-02-27 11:15:35 |       857808896 |           18.54 |
| 2020-02-27 11:15:34 |       857268224 |           19.64 |
...
+---------------------+-----------------+-----------------+
30 rows in set (0.08 sec)

InnoDB metrics

InnoDB statistics are stored as a JSON object in the EXTRA column. Use the -> operator to extract individual fields.

SELECT TIME,
       EXTRA->'$.INNODB_ROWS_READ',
       EXTRA->'$.INNODB_ROWS_INSERTED'
FROM information_schema.PERF_STATISTICS
ORDER BY TIME DESC
LIMIT 30;

Sample output:

+---------------------+-----------------------------+---------------------------------+
| TIME                | EXTRA->'$.INNODB_ROWS_READ' | EXTRA->'$.INNODB_ROWS_INSERTED' |
+---------------------+-----------------------------+---------------------------------+
| 2020-02-27 11:22:17 | 39209                       | 0                               |
| 2020-02-27 11:22:16 | 36098                       | 0                               |
...
+---------------------+-----------------------------+---------------------------------+
30 rows in set (0.08 sec)

Values in the EXTRA column match those returned by SHOW STATUS.

Connect to a monitoring platform

Connect Performance Agent to a monitoring platform for real-time dashboards. For example, connect to Grafana. Grafana

PERF_STATISTICS schema reference

Table definition

CREATE TEMPORARY TABLE `PERF_STATISTICS` (
  `TIME` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `PROCS_MEM_USAGE` double NOT NULL DEFAULT '0',
  `PROCS_MEM_RATIO` double NOT NULL DEFAULT '0',
  `PROCS_CPU_RATIO` double NOT NULL DEFAULT '0',
  `PROCS_IOPS` double NOT NULL DEFAULT '0',
  `PROCS_IOPS_READ` double NOT NULL DEFAULT '0',
  `PROCS_IOPS_WRITE` double NOT NULL DEFAULT '0',
  `PROCS_IO_READ_BYTES` bigint NOT NULL DEFAULT '0',
  `PROCS_IO_WRITE_BYTES` bigint NOT NULL DEFAULT '0',
  `MYSQL_CONN_ABORT` int NOT NULL DEFAULT '0',
  `MYSQL_CONN_CREATED` int NOT NULL DEFAULT '0',
  `MYSQL_USER_CONN_COUNT` int NOT NULL DEFAULT '0',
  `MYSQL_CONN_COUNT` int NOT NULL DEFAULT '0',
  `MYSQL_CONN_RUNNING` int NOT NULL DEFAULT '0',
  `MYSQL_CONNECTIONS` int NOT NULL DEFAULT '0',
  `MYSQL_CONN_CACHED` int NOT NULL DEFAULT '0',
  `MYSQL_LOCK_IMMEDIATE` int NOT NULL DEFAULT '0',
  `MYSQL_LOCK_WAITED` int NOT NULL DEFAULT '0',
  `MYSQL_QUESTIONS` int NOT NULL DEFAULT '0',
  `MYSQL_COM_INSERT` int NOT NULL DEFAULT '0',
  `MYSQL_COM_INSERT_SELECT` int NOT NULL DEFAULT '0',
  `MYSQL_COM_REPLACE` int NOT NULL DEFAULT '0',
  `MYSQL_COM_REPLACE_SELECT` int NOT NULL DEFAULT '0',
  `MYSQL_COM_UPDATE` int NOT NULL DEFAULT '0',
  `MYSQL_COM_UPDATE_MULTI` int NOT NULL DEFAULT '0',
  `MYSQL_COM_DELETE` int NOT NULL DEFAULT '0',
  `MYSQL_COM_DELETE_MULTI` int NOT NULL DEFAULT '0',
  `MYSQL_COM_SELECT` int NOT NULL DEFAULT '0',
  `MYSQL_COM_COMMIT` int NOT NULL DEFAULT '0',
  `MYSQL_COM_ROLLBACK` int NOT NULL DEFAULT '0',
  `MYSQL_COM_PREPARE` int NOT NULL DEFAULT '0',
  `MYSQL_HANDLER_COMMIT` int NOT NULL DEFAULT '0',
  `MYSQL_HANDELR_ROLLBACK` int NOT NULL DEFAULT '0',
  `MYSQL_LONG_QUERY` int NOT NULL DEFAULT '0',
  `MYSQL_TCACHE_GET` bigint NOT NULL DEFAULT '0',
  `MYSQL_TCACHE_MISS` bigint NOT NULL DEFAULT '0',
  `MYSQL_TMPFILE_CREATED` int NOT NULL DEFAULT '0',
  `MYSQL_TMP_TABLES` int NOT NULL DEFAULT '0',
  `MYSQL_TMP_DISKTABLES` int NOT NULL DEFAULT '0',
  `MYSQL_SORT_MERGE` int NOT NULL DEFAULT '0',
  `MYSQL_SORT_ROWS` int NOT NULL DEFAULT '0',
  `MYSQL_BYTES_RECEIVED` bigint NOT NULL DEFAULT '0',
  `MYSQL_BYTES_SENT` bigint NOT NULL DEFAULT '0',
  `MYSQL_BINLOG_OFFSET` int NOT NULL DEFAULT '0',
  `MYSQL_IOLOG_OFFSET` int NOT NULL DEFAULT '0',
  `MYSQL_RELAYLOG_OFFSET` int NOT NULL DEFAULT '0',
  `EXTRA` json NOT NULL DEFAULT 'null'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Column reference

Resource metrics

ColumnDescription
TIMETimestamp of the snapshot. Format: yyyy-MM-dd HH:mm:ss.
PROCS_MEM_USAGEPhysical memory used by the RDS instance. Unit: bytes.
PROCS_MEM_RATIOMemory usage of the MySQL process, as a ratio.
PROCS_CPU_RATIOCPU utilization of the RDS instance.
PROCS_IOPSTotal number of I/O operations.
PROCS_IOPS_READRead IOPS of the process in the container.
PROCS_IOPS_WRITEWrite IOPS of the process in the container.
PROCS_IO_READ_BYTESData read by I/O operations. Unit: bytes.
PROCS_IO_WRITE_BYTESData written by I/O operations. Unit: bytes.

Connection metrics

ColumnDescription
MYSQL_CONN_ABORTNumber of closed connections.
MYSQL_CONN_CREATEDNumber of new connections created.
MYSQL_USER_CONN_COUNTTotal number of connections.
MYSQL_CONN_COUNTTotal number of connections.
MYSQL_CONN_RUNNINGNumber of active connections.
MYSQL_CONNECTIONSNumber of MySQL connections.
MYSQL_CONN_CACHEDNumber of blocked threads.
MYSQL_LOCK_IMMEDIATENumber of locks held.
MYSQL_LOCK_WAITEDNumber of lock wait events.

SQL execution metrics

ColumnDescription
MYSQL_QUESTIONSTotal SQL statements sent by the client.
MYSQL_COM_INSERTNumber of INSERT statements.
MYSQL_COM_INSERT_SELECTNumber of INSERT ... SELECT statements.
MYSQL_COM_REPLACENumber of REPLACE statements.
MYSQL_COM_REPLACE_SELECTNumber of REPLACE ... SELECT statements.
MYSQL_COM_UPDATENumber of UPDATE statements.
MYSQL_COM_UPDATE_MULTINumber of multi-table UPDATE statements.
MYSQL_COM_DELETENumber of DELETE statements.
MYSQL_COM_DELETE_MULTINumber of multi-table DELETE statements.
MYSQL_COM_SELECTNumber of SELECT statements.
MYSQL_COM_COMMITNumber of explicitly committed transactions.
MYSQL_COM_ROLLBACKNumber of rolled-back transactions.
MYSQL_COM_PREPARENumber of prepared statements.
MYSQL_HANDLER_COMMITNumber of times the COMMIT statement executed.
MYSQL_HANDELR_ROLLBACKNumber of times the storage engine performed a rollback.
MYSQL_LONG_QUERYNumber of slow queries.
MYSQL_TCACHE_GETNumber of cache hits.
MYSQL_TCACHE_MISSNumber of cache misses.
MYSQL_TMPFILE_CREATEDNumber of temporary files created.
MYSQL_TMP_TABLESNumber of temporary tables created.
MYSQL_TMP_DISKTABLESNumber of temporary disk tables created.
MYSQL_SORT_MERGENumber of sort-merge operations.
MYSQL_SORT_ROWSNumber of rows sorted.
MYSQL_BYTES_RECEIVEDData received. Unit: bytes.
MYSQL_BYTES_SENTData sent. Unit: bytes.

Replication metrics

ColumnDescription
MYSQL_BINLOG_OFFSETSize of the binary log file generated. Unit: bytes.
MYSQL_IOLOG_OFFSETSize of the binary log file sent by the RDS instance to its secondary RDS instance. Unit: bytes.
MYSQL_RELAYLOG_OFFSETSize of the relay log applied by the secondary RDS instance. Unit: bytes.

InnoDB metrics (EXTRA column)

The EXTRA column contains a JSON object with InnoDB statistics. All values match those returned by SHOW STATUS.

FieldDescription
INNODB_TRX_CNTNumber of transactions.
INNODB_DATA_READData read. Unit: bytes.
INNODB_IBUF_SIZENumber of pages merged in the insert buffer.
INNODB_LOG_WAITSNumber of times InnoDB waited to write log data.
INNODB_MAX_PURGENumber of transactions purged.
INNODB_N_WAITINGNumber of locks InnoDB is waiting for.
INNODB_ROWS_READNumber of rows read.
INNODB_LOG_WRITESNumber of times InnoDB wrote log data.
INNODB_IBUF_MERGESNumber of insert buffer merge operations.
INNODB_DATA_WRITTENData written. Unit: bytes.
INNODB_DBLWR_WRITESNumber of doublewrite operations.
INNODB_IBUF_SEGSIZESize of data inserted into the insert buffer.
INNODB_ROWS_DELETEDNumber of rows deleted.
INNODB_ROWS_UPDATEDNumber of rows updated.
INNODB_COMMIT_TRXCNTNumber of committed transactions.
INNODB_IBUF_FREELISTLength of the idle list.
INNODB_MYSQL_TRX_CNTNumber of MySQL transactions.
INNODB_ROWS_INSERTEDNumber of rows inserted.
INNODB_ACTIVE_TRX_CNTNumber of active transactions.
INNODB_OS_LOG_WRITTENLog data written to disk. Unit: bytes.
INNODB_ACTIVE_VIEW_CNTNumber of active views.
INNODB_RSEG_HISTORY_LENLength of the TRX_RSEG_HISTORY list.
INNODB_AVG_COMMIT_TRXTIMEAverage time to commit a transaction.
INNODB_MAX_COMMIT_TRXTIMEMaximum time to commit a transaction.
INNODB_DBLWR_PAGES_WRITTENNumber of pages written by doublewrite operations.