The socket_instances Table


The socket_instances table provides a real-time snapshot of the active connections to the MariaDB server. The table contains one row per TCP/IP or Unix socket file connection. Information available in this table includes network activity such as socket instances, socket operations, and number of bytes transmitted and received.

mysql> SELECT * FROM socket_instances\G
*************************** 1. row ***************************
 EVENT_NAME: wait/io/socket/sql/server_unix_socket OBJECT_INSTANCE_BEGIN: 4316619408
 THREAD_ID: 1
 SOCKET_ID: 16
 IP: 
 PORT: 0
 STATE: ACTIVE
*************************** 2. row ***************************
 EVENT_NAME: wait/io/socket/sql/client_connection OBJECT_INSTANCE_BEGIN: 4316644608
 THREAD_ID: 21
 SOCKET_ID: 39
 IP: 127.0.0.1
 PORT: 55233
 STATE: ACTIVE
*************************** 3. row ***************************
 EVENT_NAME: wait/io/socket/sql/server_tcpip_socket OBJECT_INSTANCE_BEGIN: 4316699040
 THREAD_ID: 1
 SOCKET_ID: 14
 IP: 0.0.0.0
 PORT: 50603
 STATE: ACTIVE

Socket instruments have names of the form wait/io/socket/sql/socket_type and are used like this:

  1. The server has a listening socket for each network protocol that it supports. The instruments associated with listening sockets for TCP/IP or Unix socket file connections have a socket_type value of server_tcpip_socket or server_unix_socket, respectively.
  2. When a listening socket detects a connection, the server transfers the connection to a new socket managed by a separate thread. The instrument for the new connection thread has a socket_type value of client_connection.
  3. When a connection terminates, the row in socket_instances corresponding to it is deleted.

The socket_instances table has these columns:

The IP:PORT column combination value identifies the connection. This combination value is used in the OBJECT_NAME column of the events_waits_xxx tables, to identify the connection from which socket events come:

The socket_instances table was added in MariaDB 5.6.3.

Retornar