tencent cloud

TDSQL Boundless

LOGSERVICE_MEMORY_STAT

Download
Mode fokus
Ukuran font
Terakhir diperbarui: 2026-07-17 16:08:45

Function

INFORMATION_SCHEMA.LOGSERVICE_MEMORY_STAT is used to display memory usage statistics for all LogServices (in MySQLClient mode) in the cluster. These statistics include the global memory usage of LogServices, the memory occupied by individual Replication Groups (hereafter referred to as RGs), and the usage of the cache flushed to disk when memory limits are exceeded. The view also exposes the currently effective memory quotas, throttling thresholds, and throttling reasons to facilitate the diagnosis of memory pressure and push-down blocking issues in the consumption pipeline under the MySQLClient mode.
The view displays statistics granularity row by row, distinguished by the STAT_TYPE column:
GLOBAL: global statistics per LogService. One row is output for each LogService.
RG: statistics per RG. One row is output for each active RG under each LogService.
Memory is counted in three layers, corresponding to the three stages of message flow in the MySQL Client consumption pipeline:
BinlogHandler layer: the memory occupied by messages generated after Binlog is parsed.
ConflictDetector layer: the memory occupied by messages waiting to be merged after the sorting operations based on commit_ts are performed.
MysqlQueue layer: the memory occupied by messages that have been dispatched to the MySQL execution queue and are awaiting SQL execution.

Field Description

Field Name
Type
Description
STAT_TYPE
VARCHAR(16)
The statistical granularity. The value is GLOBAL (LogService global statistics) or RG (single RG statistics).
SID
BIGINT UNSIGNED
LogService instance ID.
RG_ID
BIGINT UNSIGNED
The Replication Group ID. It is valid when STAT_TYPE='RG' and is NULL when STAT_TYPE='GLOBAL'.
TOTAL_MEM_BYTES
BIGINT UNSIGNED
The total amount of memory currently in use, in bytes. It is the total occupancy of the entire LogService when STAT_TYPE='GLOBAL' and is the sum of the occupancy of this RG across the three layers when STAT_TYPE='RG'.
BINLOG_HANDLER_MEM_BYTES
BIGINT UNSIGNED
The memory occupancy of the BinlogHandler layer, in bytes.
CONFLICT_DETECTOR_MEM_BYTES
BIGINT UNSIGNED
The memory occupancy of the ConflictDetector layer, in bytes.
MYSQL_QUEUE_MEM_BYTES
BIGINT UNSIGNED
The memory occupancy of the MysqlQueue layer, in bytes.
SOFT_LIMIT_BYTES
BIGINT UNSIGNED
The soft limit for the global memory of LogService, in bytes. When the occupancy reaches this value, throttling is triggered for RGs that do not have the globally minimum commit_ts. It is valid only when STAT_TYPE='GLOBAL' and is NULL otherwise. This value is controlled by the system variable binlog_mysqlclient_cache_max_size.
HARD_LIMIT_BYTES
BIGINT UNSIGNED
The hard limit for the global memory of LogService, in bytes. When the occupancy exceeds this value, an alarm log is generated, but the RG with the globally minimum commit_ts is still allowed to continue allocating memory to prevent the push-down link from being blocked. It is valid only when STAT_TYPE='GLOBAL' and is NULL otherwise. This value is determined jointly by the system variable binlog_mysqlclient_cache_hard_limit_ratio and SOFT_LIMIT_BYTES.
PER_RG_LIMIT_BYTES
BIGINT UNSIGNED
The memory quota for a single RG, in bytes. It is valid only when STAT_TYPE='GLOBAL' and is NULL otherwise. This value is controlled by the system variable log_service_per_rg_mem_limit.
COMMIT_TS
BIGINT UNSIGNED
The current commit timestamp of the RG. It is valid only when STAT_TYPE='RG' and is NULL otherwise.
IS_MIN_TS_RG
SMALLINT
Whether the RG has the globally minimum commit_ts within the current LogService. 1 indicates yes, and 0 indicates no. The RG with the minimum commit_ts can continue to allocate memory when the memory limit is exceeded, preventing the global push-down from being blocked. It is valid only when STAT_TYPE='RG' and is NULL otherwise.
BLOCK_REASON
VARCHAR(256)
The description of the reason why the RG is currently being throttled. An empty string or NULL indicates that it is not being throttled. It is valid only when STAT_TYPE='RG'.
FLUSH_DISK_WRITE_COUNT
BIGINT UNSIGNED
The cumulative number of times that data in memory is flushed to disk.
FLUSH_DISK_WRITE_BYTES
BIGINT UNSIGNED
The cumulative number of bytes of data in memory that are flushed to disk.
FLUSH_DISK_READ_COUNT
BIGINT UNSIGNED
The cumulative number of times that data is read back from the disk cache to memory.
FLUSH_DISK_READ_BYTES
BIGINT UNSIGNED
The cumulative number of bytes of data that are read back from the disk cache to memory.
FLUSH_DISK_ON_DISK_BYTES
BIGINT UNSIGNED
The estimated amount of data that currently remains in the disk cache, in bytes. It equals FLUSH_DISK_WRITE_BYTES - FLUSH_DISK_READ_BYTES, with a lower limit of 0.
DISK_SOFT_LIMIT_BYTES
BIGINT UNSIGNED
The global soft limit for the disk cache, in bytes. It is valid only when STAT_TYPE='GLOBAL' and is NULL otherwise.
PER_RG_DISK_LIMIT_BYTES
BIGINT UNSIGNED
The disk cache quota for a single RG, in bytes. It is valid only when STAT_TYPE='GLOBAL' and is NULL otherwise.

Examples

To query the global memory usage of a specific LogService:
tdsql > SELECT * FROM information_schema.logservice_memory_stat WHERE stat_type='GLOBAL'\\G
*************************** 1. row ***************************
STAT_TYPE: GLOBAL
SID: 1001
RG_ID: NULL
TOTAL_MEM_BYTES: 268435456
BINLOG_HANDLER_MEM_BYTES: 33554432
CONFLICT_DETECTOR_MEM_BYTES: 167772160
MYSQL_QUEUE_MEM_BYTES: 67108864
SOFT_LIMIT_BYTES: 1073741824
HARD_LIMIT_BYTES: 2147483648
PER_RG_LIMIT_BYTES: 104857600
COMMIT_TS: NULL
IS_MIN_TS_RG: NULL
BLOCK_REASON: NULL
FLUSH_DISK_WRITE_COUNT: 0
FLUSH_DISK_WRITE_BYTES: 0
FLUSH_DISK_READ_COUNT: 0
FLUSH_DISK_READ_BYTES: 0
FLUSH_DISK_ON_DISK_BYTES: 0
DISK_SOFT_LIMIT_BYTES: 4294967296
PER_RG_DISK_LIMIT_BYTES: 536870912
1 row in set (0.00 sec)
To query RGs experiencing throttling and locate the cause of push-down blocking:
tdsql > SELECT sid, rg_id, total_mem_bytes, commit_ts, is_min_ts_rg, block_reason
-> FROM information_schema.logservice_memory_stat
-> WHERE stat_type='RG' AND block_reason IS NOT null AND block_reason <> ''\\G
*************************** 1. row ***************************
SID: 1001
RG_ID: 8001
TOTAL_MEM_BYTES: 104857600
COMMIT_TS: 452937184905367553
IS_MIN_TS_RG: 0
BLOCK_REASON: per-RG quota exceeded
*************************** 2. row ***************************
SID: 1001
RG_ID: 8005
TOTAL_MEM_BYTES: 838860800
COMMIT_TS: 452937184905431041
IS_MIN_TS_RG: 0
BLOCK_REASON: Global memory exceeded soft limit
2 rows in set (0.00 sec)
To query the Top 5 RGs by memory usage:
tdsql > SELECT sid, rg_id, total_mem_bytes, commit_ts, is_min_ts_rg
-> FROM information_schema.logservice_memory_stat
-> WHERE stat_type='RG'
-> ORDER BY total_mem_bytes DESC LIMIT 5;
+------+-------+-----------------+--------------------+--------------+
| SID | RG_ID | TOTAL_MEM_BYTES | COMMIT_TS | IS_MIN_TS_RG |
+------+-------+-----------------+--------------------+--------------+
| 1001 | 8005 | 838860800 | 452937184905431041 | 0 |
| 1001 | 8003 | 419430400 | 452937184905298945 | 1 |
| 1001 | 8001 | 104857600 | 452937184905367553 | 0 |
| 1001 | 8002 | 62914560 | 452937184905312257 | 0 |
| 1001 | 8004 | 20971520 | 452937184905384961 | 0 |
+------+-------+-----------------+--------------------+--------------+
5 rows in set (0.00 sec)

Bantuan dan Dukungan

Apakah halaman ini membantu?

masukan