Open crazycs520 opened 3 years ago
@breeswish PTAL
Ideas are great! However I have some product oriented concerns: How does MySQL and Oracle provide such information?
@morgo PTAL
This is awesome! So excited to see someone looking into this. /cc @dveeden
Ideas are great! However I have some product oriented concerns: How does MySQL and Oracle provide such information?
In MySQL, they use performance_schema
, but across a few separate tables. In Percona Server they also have THREAD_STATISTICS
if you are looking for inspiration.
We also have some feature requests for TiDB that don't exactly match this but may be useful:
A couple of specific suggestions:
connection_attributes
. Modern clients will capture some additional info like the client version, OS name, PID, etc. We can represent it as JSON. These are useful in debugging - clients can be broken!ns
instead of seconds? For OLTP, seconds is really long. And other timers such as statements_summary
are in ns. There are helper functions to convert such as FORMAT_NANO_TIME()
which we can show in examples.create_time
, begin_time
etc, try and use the style and case that matches statement_summary
. i.e. s/total_wall_cmd_time/SUM_STATEMENT_LATENCY/.@breeswish
Ideas are great! However I have some product oriented concerns: How does MySQL and Oracle provide such information?
for MySQL 8
has following information in performance_schema
events_stages_summary_by_?_by_event_name
events_statements_summary_by_?_by_event_name
events_transactions_summary_by_?_by_event_name
events_waits_summary_by_?_by_event_name
memory_summary_by_?_by_event_name
? could be either user, host, or account(per connection) and also exist for global
for acquiring the user information could join
the table information_schema.processlist
and performance_schema.accounts
performance_schema.accounts
has rows
`information_schema.processlist has rows
Please do add these:
See also "Visibility into TLS version" on https://mysqlserverteam.com/ssltls-improvements-in-mysql-5-7-10/
Also see what performance_schema.threads
has in MySQL 8.0.26:
mysql-8.0.26 > SELECT * FROM performance_schema.threads WHERE NAME='thread/sql/one_connection'\G
*************************** 1. row ***************************
THREAD_ID: 51
NAME: thread/sql/one_connection
TYPE: FOREGROUND
PROCESSLIST_ID: 8
PROCESSLIST_USER: msandbox
PROCESSLIST_HOST: localhost
PROCESSLIST_DB: NULL
PROCESSLIST_COMMAND: Query
PROCESSLIST_TIME: 0
PROCESSLIST_STATE: executing
PROCESSLIST_INFO: SELECT * FROM performance_schema.threads WHERE NAME='thread/sql/one_connection'
PARENT_THREAD_ID: 1
ROLE: NULL
INSTRUMENTED: YES
HISTORY: YES
CONNECTION_TYPE: Socket
THREAD_OS_ID: 25605
RESOURCE_GROUP: USR_default
1 row in set (0.00 sec)
There is no "thread" concept in TiDB. We need some adoption.
There is no "thread" concept in TiDB. We need some adoption.
THREAD_ID: 51
...
PROCESSLIST_ID: 8
...
THREAD_OS_ID: 25605
TiDB has the connection ID, which is the PROCESSLIST_ID
here (matches the ID
column from SHOW PROCESSLIST
)
The THREAD_OS_ID
could map to the ID of the goroutine. It could also map to OS tasks for the tidb-server
process.
$ ls /proc/$(pgrep -x tidb-server)/task/
27504 27506 27508 27510 27512 27515 27517 27519 27525 27530 27608
27505 27507 27509 27511 27513 27516 27518 27520 27526 27531
This could be used to move specific tasks to a different CGroup giving them different resource constraints, priorities, etc. However I don't think with the way Go and TiDB works that this makes any sense. So I would suggest to not expose this.
And the THREAD_ID
here is for performance_schema
and doesn't apply to TiDB as long as there is no performance_schema
Idea is great! I am concerned that will the connection_status
eventually explode into another dashboard in INFORMATION_SCHEMA
?
As so many people are asking for fields in this table, IMHO we definitely need a proposal for this feature.
Maybe rename the table name from connection_status
to connection_summary
is better.
Feature Request
Is your feature request related to a problem? Please describe:
Add the following
connection_summary
table inINFORMATION_SCHEMA
.The main information the I want to gain from
connection_summary
table is the following summary information:total_wait_cmd_time
: the total wait command duration of this connection since thebegin_time
.total_exec_cmd_time
: the total exec command duration of this connection since thebegin_time
.total_write_resp_time
: the total write command response duration of this connection since thebegin_time
.I add
begin_time
since I want to reset the value of those summary columns (total_xxx_time
). So I also want to make that summary information only contain the most recent data, so I may also want to add a global variable, such asset @@tidb_connection_summary_summary_refresh_interval=1800
.With the connection summary information(
total_xxx_time
), it is very easy to know which connection is very idle, and if thetotal_wait_cmd_time
value is very large, it means the load pressure of this connection is very small.Describe the feature you'd like:
Describe alternatives you've considered:
Teachability, Documentation, Adoption, Migration Strategy: