PDF (A4) - 41.3Mb
Man Pages (TGZ) - 262.8Kb
Man Pages (Zip) - 368.8Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb
Thesocket_instances table provides a real-time snapshot of the active connections to the MySQL server. The table contains one row per TCP/IP or Unix socket file connection. Information available in this table provides a real-time snapshot of the active connections to the server. (Additional information is available in socket summary tables, including network activity such as socket operations and number of bytes transmitted and received; seeSection 29.12.20.9, “Socket Summary Tables”).
mysql> SELECT * FROM performance_schema.socket_instances\G*************************** 1. row *************************** EVENT_NAME: wait/io/socket/sql/server_unix_socketOBJECT_INSTANCE_BEGIN: 4316619408 THREAD_ID: 1 SOCKET_ID: 16 IP: PORT: 0 STATE: ACTIVE*************************** 2. row *************************** EVENT_NAME: wait/io/socket/sql/client_connectionOBJECT_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_socketOBJECT_INSTANCE_BEGIN: 4316699040 THREAD_ID: 1 SOCKET_ID: 14 IP: 0.0.0.0 PORT: 50603 STATE: ACTIVE Socket instruments have names of the formwait/io/socket/sql/ and are used like this:socket_type
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_typevalue ofserver_tcpip_socketorserver_unix_socket, respectively.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_typevalue ofclient_connection.When a connection terminates, the row in
socket_instancescorresponding to it is deleted.
Thesocket_instances table has these columns:
EVENT_NAMEThe name of the
wait/io/socket/*instrument that produced the event. This is aNAMEvalue from thesetup_instrumentstable. Instrument names may have multiple parts and form a hierarchy, as discussed inSection 29.6, “Performance Schema Instrument Naming Conventions”.OBJECT_INSTANCE_BEGINThis column uniquely identifies the socket. The value is the address of an object in memory.
THREAD_IDThe internal thread identifier assigned by the server. Each socket is managed by a single thread, so each socket can be mapped to a thread which can be mapped to a server process.
SOCKET_IDThe internal file handle assigned to the socket.
IPThe client IP address. The value may be either an IPv4 or IPv6 address, or blank to indicate a Unix socket file connection.
PORTThe TCP/IP port number, in the range from 0 to 65535.
STATEThe socket status, either
IDLEorACTIVE. Wait times for active sockets are tracked using the corresponding socket instrument. Wait times for idle sockets are tracked using theidleinstrument.A socket is idle if it is waiting for a request from the client. When a socket becomes idle, the event row in
socket_instancesthat is tracking the socket switches from a status ofACTIVEtoIDLE. TheEVENT_NAMEvalue remainswait/io/socket/*, but timing for the instrument is suspended. Instead, an event is generated in theevents_waits_currenttable with anEVENT_NAMEvalue ofidle.When the next request is received, the
idleevent terminates, the socket instance switches fromIDLEtoACTIVE, and timing of the socket instrument resumes.
Thesocket_instances table has these indexes:
Primary key on (
OBJECT_INSTANCE_BEGIN)Index on (
THREAD_ID)Index on (
SOCKET_ID)Index on (
IP,PORT)
TRUNCATE TABLE is not permitted for thesocket_instances table.
TheIP:PORT column combination value identifies the connection. This combination value is used in theOBJECT_NAME column of theevents_waits_ tables, to identify the connection from which socket events come:xxx
For the Unix domain listener socket (
server_unix_socket), the port is 0, and the IP is''.For client connections via the Unix domain listener (
client_connection), the port is 0, and the IP is''.For the TCP/IP server listener socket (
server_tcpip_socket), the port is always the master port (for example, 3306), and the IP is always0.0.0.0.For client connections via the TCP/IP listener (
client_connection), the port is whatever the server assigns, but never 0. The IP is the IP of the originating host (127.0.0.1or::1for the local host)
PDF (A4) - 41.3Mb
Man Pages (TGZ) - 262.8Kb
Man Pages (Zip) - 368.8Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb