1. Performance monitoring
1. View the ongoing process
show processlist;
2. View the current maximum number of connections
show variables like 'max_connections';
3. Set the maximum number of mysql connections (default 151 can be adjusted to 512)
set global max_connections=1024;
4. View trying to connect to MySQL
show status like 'connections';
5. View the number of threads in the thread cache
show status like 'threads_cached';
6. View the number of currently open connections
show status like 'threads_connected';
7. View the number of threads created to handle connections
show status like 'threads_created';
8. View the number of active (non-sleeping) threads
show status like 'threads_running';
9. View the number of locks on the table immediately acquired
show status like 'table_locks_immediate';
10. View the number of locks on the table that cannot be obtained immediately.
If the value is high and there are performance issues, you should optimize the query first, then split the table or use replication.
show status like 'table_locks_waited';