Updated on 2024-07-12 GMT+08:00

Querying the Top I/O Threads

Function

This API is used to query top I/O statistics of instance database processes and return the results associated with session information. Before calling this API:

Constraints

The resource type and operating system of instances must support the pidstat command.

URI

GET https://{Endpoint}/v3/{project_id}/instances/{instance_id}/top-io-traffics?node_id={node_id}&component_id={component_id}&top_io_num={top_io_num}&sort_condition={sort_condition}

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

For details about how to obtain the project ID, see Obtaining a Project ID.

instance_id

Yes

String

Instance ID.

node_id

Yes

String

Node ID. It must be a CN or a DN node of a non-log role, and the node status must be normal. To obtain the value, see Querying the Components of a DB Instance.

component_id

Yes

String

Component ID. It must be a CN or a DN component of a non-log role. To obtain the value, see Querying the Components of a DB Instance.

  • Data node (DN): stores and queries table data.
  • Coordinator node (CN): stores database metadata, distributes and executes query tasks, and then returns the query results from DNs to applications.

top_io_num

No

Integer

Number of top I/O threads to be queried in the database process. The default value is 20. The returned result includes information about the top I/O threads with associated session information. The number of records returned in the result cannot exceed the value of this parameter.

sort_condition

No

String

Top I/O sorting condition.

Value:

  • read
  • write

Request Parameters

None

Response Parameters

Table 2 Parameter description

Parameter

Type

Description

top_io_infos

Array of objects

I/O information. Each element in the list indicates an I/O record. For details, see Table 3.

Table 3 top_io_infos field data structure description

Parameter

Type

Description

thread_id

String

Thread ID.

thread_type

String

Thread type. The value can be worker or background. To use this parameter, set enable_thread_pool to on.

Value:

  • worker
  • background

disk_read_rate

Integer

Rate of reading data from disks, in KB/s.

disk_write_rate

Integer

Rate of writing data to the disk, in KB/s.

session_id

String

Session ID.

unique_sql_id

String

SQL ID.

database_name

String

Database.

client_ip

String

IP address of the client.

user_name

String

Username.

state

String

Status.

sql_start

Integer

Start time of the statement.

Example Request

Top I/Os queried.

GET https://gaussdb-opengauss.ap-southeast-1.myhuaweicloud.com/v3/0483b6b16e954cb88930a360d2c4e663/instances/{instance_id}/top-io-traffics?node_id=42cbf784585e419d9eb33c005f4ced94no14&component_id=dn_6001&top_io_num=20&sort_condition=write

Example Response

{ 
  "top_io_infos" : [ { 
    "thread_id" : "55067", 
    "thread_type" : "worker", 
    "disk_read_rate" : 0, 
    "disk_write_rate" : 1.43, 
    "session_id" : "725", 
    "unique_sql_id" : "3545025713", 
    "database_name" : "postgres", 
    "client_ip" : "23.100.74.131", 
    "user_name" : "root", 
    "state" : "active", 
    "sql_start" : 1690448618689 
  } ] 
}

Status Code

Error Code

For details, see Error Codes.