This topic describes how to query the internal metrics of a specified client session in OceanBase Database Proxy (ODP), such as the SQL response count and SQL response size.
View the internal metrics of a specified client session
You can use the SHOW PROXYSESSION STAT id [like 'xx'] statement to query the internal metrics of a specified session in ODP.
Parameters:
In the statement,
idcan be replaced withcs_idorconnection_id. These parameters are equivalent.cs_idindicates theIDof a client session in ODP.CONNECTION_IDindicates theIDof a client session in OceanBase Database. For more information aboutCONNECTION_ID, see CONNECTION_ID.The like section supports fuzzy match. Supported wildcard characters are the percent sign (%) and the underscore (_).
Sample code:
obclient> SHOW PROXYSESSION STAT 3;
+--------------------------------------------------+-----------+
| stat_name | value |
+--------------------------------------------------+-----------+
| total_transaction_count | 100 |
| client_request_total_size | 2391 |
| client_response_total_size | 16968 |
| server_request_total_size | 2068 |
| server_response_total_size | 7676 |
| total_transactions_time | 406854594 |
| total_client_request_read_time | 10823905 |
| total_client_response_write_time | 0 |
| total_client_request_analyze_time | 4147091 |
| total_server_process_request_time | 244970812 |
| total_server_response_read_time | 33951745 |
| total_send_saved_login_time | 16869682 |
| total_send_all_session_vars_time | 0 |
| total_send_use_database_time | 3165510 |
| total_send_changed_session_vars_time | 0 |
| total_send_last_insert_id_time | 0 |
| total_send_start_trans_time | 0 |
| total_pl_lookup_time | 756611 |
| total_server_connect_time | 3196171 |
| client_requests | 100 |
| client_large_requests | 0 |
| client_internal_requests | 14 |
| client_missing_pk_requests | 85 |
| client_completed_requests | 99 |
| client_connection_abort_count | 0 |
| client_select_requests | 4 |
| client_insert_requests | 0 |
| client_update_requests | 0 |
| client_delete_requests | 0 |
| client_other_requests | 3 |
| request_size_100_count | 99 |
| request_size_1K_count | 0 |
| request_size_3K_count | 0 |
| request_size_5K_count | 0 |
| request_size_10K_count | 0 |
| request_size_1M_count | 0 |
| request_size_inf_count | 0 |
| response_size_100_count | 96 |
| response_size_1K_count | 1 |
| response_size_3K_count | 2 |
| response_size_5K_count | 0 |
| response_size_10K_count | 0 |
| response_size_1M_count | 0 |
| response_size_inf_count | 0 |
| client_speed_bytes_per_sec_100 | 0 |
| client_speed_bytes_per_sec_1K | 0 |
| client_speed_bytes_per_sec_10K | 0 |
| client_speed_bytes_per_sec_100K | 0 |
| client_speed_bytes_per_sec_1M | 0 |
| client_speed_bytes_per_sec_10M | 0 |
| client_speed_bytes_per_sec_100M | 0 |
| server_speed_bytes_per_sec_100 | 0 |
| server_speed_bytes_per_sec_1K | 0 |
| server_speed_bytes_per_sec_10K | 0 |
| server_speed_bytes_per_sec_100K | 2 |
| server_speed_bytes_per_sec_1M | 81 |
| server_speed_bytes_per_sec_10M | 2 |
| server_speed_bytes_per_sec_100M | 0 |
| server_connect_count | 4 |
| server_connect_retries | 0 |
| server_pl_lookup_count | 4 |
| server_pl_lookup_retries | 0 |
| broken_server_connections | 0 |
| server_requests | 91 |
| server_responses | 95 |
| server_error_responses | 77 |
| server_resultset_responses | 7 |
| server_ok_responses | 7 |
| server_other_responses | 4 |
| send_saved_login_requests | 3 |
| send_all_session_vars_requests | 0 |
| send_use_database_requests | 3 |
| send_changed_session_vars_requests | 0 |
| send_last_insert_id_requests | 0 |
| send_start_trans_requests | 0 |
| vip_to_tenant_cache_hit | 0 |
| vip_to_tenant_cache_miss | 0 |
+--------------------------------------------------+-----------+
77 rows in set
obclient> SHOW PROXYSESSION STAT 2147549231;
+--------------------------------------------------+-----------+
| stat_name | value |
+--------------------------------------------------+-----------+
| total_transaction_count | 101 |
| client_request_total_size | 2420 |
| client_response_total_size | 20576 |
| server_request_total_size | 2068 |
| server_response_total_size | 7676 |
| total_transactions_time | 408855677 |
| total_client_request_read_time | 10987827 |
| total_client_response_write_time | 0 |
| total_client_request_analyze_time | 4244033 |
| total_server_process_request_time | 244970812 |
| total_server_response_read_time | 33951745 |
| total_send_saved_login_time | 16869682 |
| total_send_all_session_vars_time | 0 |
| total_send_use_database_time | 3165510 |
| total_send_changed_session_vars_time | 0 |
| total_send_last_insert_id_time | 0 |
| total_send_start_trans_time | 0 |
| total_pl_lookup_time | 756611 |
| total_server_connect_time | 3196171 |
| client_requests | 101 |
| client_large_requests | 0 |
| client_internal_requests | 15 |
| client_missing_pk_requests | 85 |
| client_completed_requests | 100 |
| client_connection_abort_count | 0 |
| client_select_requests | 4 |
| client_insert_requests | 0 |
| client_update_requests | 0 |
| client_delete_requests | 0 |
| client_other_requests | 3 |
| request_size_100_count | 100 |
| request_size_1K_count | 0 |
| request_size_3K_count | 0 |
| request_size_5K_count | 0 |
| request_size_10K_count | 0 |
| request_size_1M_count | 0 |
| request_size_inf_count | 0 |
| response_size_100_count | 97 |
| response_size_1K_count | 1 |
| response_size_3K_count | 2 |
| response_size_5K_count | 0 |
| response_size_10K_count | 0 |
| response_size_1M_count | 0 |
| response_size_inf_count | 0 |
| client_speed_bytes_per_sec_100 | 0 |
| client_speed_bytes_per_sec_1K | 0 |
| client_speed_bytes_per_sec_10K | 0 |
| client_speed_bytes_per_sec_100K | 0 |
| client_speed_bytes_per_sec_1M | 0 |
| client_speed_bytes_per_sec_10M | 0 |
| client_speed_bytes_per_sec_100M | 0 |
| server_speed_bytes_per_sec_100 | 0 |
| server_speed_bytes_per_sec_1K | 0 |
| server_speed_bytes_per_sec_10K | 0 |
| server_speed_bytes_per_sec_100K | 2 |
| server_speed_bytes_per_sec_1M | 81 |
| server_speed_bytes_per_sec_10M | 2 |
| server_speed_bytes_per_sec_100M | 0 |
| server_connect_count | 4 |
| server_connect_retries | 0 |
| server_pl_lookup_count | 4 |
| server_pl_lookup_retries | 0 |
| broken_server_connections | 0 |
| server_requests | 91 |
| server_responses | 95 |
| server_error_responses | 77 |
| server_resultset_responses | 7 |
| server_ok_responses | 7 |
| server_other_responses | 4 |
| send_saved_login_requests | 3 |
| send_all_session_vars_requests | 0 |
| send_use_database_requests | 3 |
| send_changed_session_vars_requests | 0 |
| send_last_insert_id_requests | 0 |
| send_start_trans_requests | 0 |
| vip_to_tenant_cache_hit | 0 |
| vip_to_tenant_cache_miss | 0 |
+--------------------------------------------------+-----------+
77 rows in set
obclient> SHOW PROXYSESSION STAT 2147549231 like "%time%";
+--------------------------------------------------+-----------+
| stat_name | value |
+--------------------------------------------------+-----------+
| total_transactions_time | 410877642 |
| total_client_request_read_time | 11192818 |
| total_client_response_write_time | 0 |
| total_client_request_analyze_time | 4355363 |
| total_server_process_request_time | 244970812 |
| total_server_response_read_time | 33951745 |
| total_send_saved_login_time | 16869682 |
| total_send_all_session_vars_time | 0 |
| total_send_use_database_time | 3165510 |
| total_send_changed_session_vars_time | 0 |
| total_send_last_insert_id_time | 0 |
| total_send_start_trans_time | 0 |
| total_pl_lookup_time | 756611 |
| total_server_connect_time | 3196171 |
+--------------------------------------------------+-----------+
14 rows in set
The following table describes the fields in the returned result.
| Field | Description |
|---|---|
| stat_name | The name of the internal metric. |
| value | The value of the internal metric. |
The following table describes the internal metrics.
| Metric | Description |
|---|---|
| total_transaction_count | The total number of transactions. |
| client_request_total_size | The total size of the request data. |
| client_response_total_size | The total size of the response data. |
| server_request_total_size | The total size of the request data sent to OBServer nodes. |
| server_response_total_size | The total size of the response data returned by OBServer nodes. |
| total_transactions_time | The total amount of time consumed to execute transactions. |
| total_client_request_read_time | The total amount of time consumed to read client requests. |
| total_client_response_write_time | The total amount of time consumed to return data to the client. |
| total_client_request_analyze_time | The total amount of time consumed to parse client packets. |
| total_server_process_request_time | The total amount of time consumed by the database to process requests. |
| total_server_response_read_time | The total amount of time consumed for reading the data returned by OBServer nodes. |
| total_send_saved_login_time | The total amount of time consumed for sending LOGIN packets to OBServer nodes. |
| total_send_all_session_vars_time | The total amount of time consumed for synchronizing session variables to OBServer nodes. |
| total_send_use_database_time | The total amount of time consumed for sending the use database command to OBServer nodes. |
| total_send_changed_session_vars_time | The total amount of time consumed for sending session variable modifications to OBServer nodes. |
| total_send_last_insert_id_time | The total amount of time consumed for synchronizing values of last_insert_id to OBServer nodes. |
| total_send_start_trans_time | The total amount of time consumed for sending the request that starts transactions to OBServer nodes. |
| total_pl_lookup_time | The total amount of routing time. |
| total_server_connect_time | The total amount of time consumed for creating connections between the ODP and OBServer nodes. |
| client_requests | The total number of requests. |
| client_large_requests | The number of large requests. |
| client_internal_requests | The number of internal requests. |
| client_missing_pk_requests | The number of requests that do not need to be routed but need to use the connection of the last request. |
| client_completed_requests | The number of completed requests. |
| client_connection_abort_count | The number of aborted connections. |
| client_select_requests | The total number of SELECT requests. |
| client_insert_requests | The total number of INSERT requests. |
| client_update_requests | The total number of UPDATE requests. |
| client_delete_requests | The total number of DELETE requests. |
| client_other_requests | The total number of other requests. |
| request_size_100_count | The number of requests within the size range of [0,100). |
| request_size_1K_count | The number of requests within the size range of [100,1000). |
| request_size_3K_count | The number of requests within the size range of [1000,3000). |
| request_size_5K_count | The number of requests within the size range of [3000,5000). |
| request_size_10K_count | The number of requests within the size range of [5000,10000). |
| request_size_1M_count | The number of requests within the size range of [10000,1000000). |
| request_size_inf_count | The number of requests within the size range of [1000000,+∞). |
| response_size_100_count | The number of responses within the size range of [0,100). |
| response_size_1K_count | The number of responses within the size range of [100,1000). |
| response_size_3K_count | The number of responses within the size range of [1000,3000). |
| response_size_5K_count | The number of responses within the size range of [3000,5000). |
| response_size_10K_count | The number of responses within the size range of [5000,10000). |
| response_size_1M_count | The number of responses within the size range of [10000,1000000). |
| response_size_inf_count | The number of responses within the size range of [1000000,+∞). |
| client_speed_bytes_per_sec_100 | The number of clients whose size of request data sent per second is within the range of [0,100). |
| client_speed_bytes_per_sec_1K | The number of clients whose size of request data sent per second is within the range of [100,1000). |
| client_speed_bytes_per_sec_10K | The number of clients whose size of request data sent per second is within the range of [1000,10000). |
| client_speed_bytes_per_sec_100K | The number of clients whose size of request data sent per second is within the range of [10000,100000). |
| client_speed_bytes_per_sec_1M | The number of clients whose size of request data sent per second is within the range of [100000,1000000). |
| client_speed_bytes_per_sec_10M | The number of clients whose size of request data sent per second is within the range of [1000000,10000000). |
| client_speed_bytes_per_sec_100M | The number of clients whose size of request data sent per second is within the range of [10000000,+∞). |
| server_speed_bytes_per_sec_100 | The number of OBServer nodes whose size of response data sent per second is within the range of [0,100). |
| server_speed_bytes_per_sec_1K | The number of OBServer nodes whose size of response data sent per second is within the range of [100,1000). |
| server_speed_bytes_per_sec_10K | The number of OBServer nodes whose size of response data sent per second is within the range of [1000,10000). |
| server_speed_bytes_per_sec_100K | The number of OBServer nodes whose size of response data sent per second is within the range of [10000,100000). |
| server_speed_bytes_per_sec_1M | The number of OBServer nodes whose size of response data sent per second is within the range of [100000,1000000). |
| server_speed_bytes_per_sec_10M | The number of OBServer nodes whose size of response data sent per second is within the range of [1000000,10000000). |
| server_speed_bytes_per_sec_100M | The number of OBServer nodes whose size of response data sent per second is within the range of [10000000,+∞). |
| server_connect_count | The total number of connections to OBServer nodes. |
| server_connect_retries | The total number of reconnections to OBServer nodes. |
| server_pl_lookup_count | The total number of times routing is performed. |
| server_pl_lookup_retries | The total number of routing retries. |
| broken_server_connections | The total number of disconnections from OBServer nodes. |
| server_requests | The total number of requests sent to OBServer nodes. |
| server_responses | The total number of responses received from OBServer nodes. |
| server_error_responses | The total number of ERROR responses received from OBServer nodes. |
| server_resultset_responses | The total number of resultset responses received from OBServer nodes. |
| server_ok_responses | The total number of OK responses received from OBServer nodes. |
| server_other_responses | The total number of other responses received from OBServer nodes. |
| send_saved_login_requests | The total number of LOGIN packets sent to OBServer nodes. |
| send_all_session_vars_requests | The total number of times that all session variables are sent to OBServer nodes. |
| send_use_database_requests | The total number of times that the use database command is sent to OBServer nodes. |
| send_changed_session_vars_requests | The total number of times that part of session variables are sent to OBServer nodes. |
| send_last_insert_id_requests | The total number of times that the values of last insert id are sent to OBServer nodes. |
| send_start_trans_requests | The total number of times that the request for starting transactions is sent to OBServer nodes. |
| vip_to_tenant_cache_hit | The number of hits in queries of VIP information in the public cloud. |
| vip_to_tenant_cache_miss | The number of cache misses for VIP information queries in the public cloud. |