msyql数据库性能监控整理
1、监控thread_cache命中率
admin@localhost : (none) 07:51:20> show variables like '%thread%';
+---------------------------------------+---------------------------+
| Variable_name
+---------------------------------------+---------------------------+
| innodb_read_io_threads
| innodb_thread_concurrency
| innodb_thread_concurrency_timer_based | OFF
| innodb_thread_sleep_delay
| innodb_use_purge_thread
| innodb_write_io_threads
| max_delayed_threads
| max_insert_delayed_threads
| myisam_repair_threads
| pseudo_thread_id
| thread_cache_size
| thread_handling
| thread_stack
| thread_statistics
+---------------------------------------+---------------------------+
14 rows in set (0.00 sec)
admin@localhost : (none) 07:50:50> show status like '%connection%';
+----------------------+---------+
| Variable_name
+----------------------+---------+
| Connections
| Max_used_connections | 1008
+----------------------+---------+
2 rows in set (0.01 sec)
admin@localhost : (none) 07:51:08> show status like '%thread%';
+----------------------------+-------+
| Variable_name
+----------------------------+-------+
| Com_show_thread_statistics | 0
| Delayed_insert_threads
| Slow_launch_threads
| Threads_cached
| Threads_connected
| Threads_created
| Threads_running
+----------------------------+-------+
7 rows in set (0.00 sec)
从上可以看出到目前为止服务器共有2920267 次连接,最大并发数为1008,当前thread_cahce中连接有219个,连接数为790个,共创建了2821次连接,当前活跃的有4个。
2、监控innodb cache
admin@localhost : (none) 08:08:24> show status like '%innodb_buffer_pool_read%';
+---------------------------------------+--------------+
| Variable_name
+---------------------------------------+--------------+
| Innodb_buffer_pool_read_ahead_rnd
| Innodb_buffer_pool_read_ahead
| Innodb_buffer_pool_read_ahead_evicted | 938110
| Innodb_buffer_pool_read_requests
| Innodb_buffer_pool_reads
+---------------------------------------+--------------+
5 rows in set (0.00 sec)
admin@localhost : (none) 08:08:32> show status like '%innodb_buffer_pool_wait%';
+------------------------------+-------+
| Variable_name
+------------------------------+-------+
| Innodb_buffer_pool_wait_free | 27
+------------------------------+-------+
1 row in set (0.00 sec)
admin@localhost : (none) 08:09:06> show variables like '%innodb_buffer%';
+---------------------------------+-------------+
| Variable_name
+---------------------------------+-------------+
| innodb_buffer_pool_shm_checksum | ON
| innodb_buffer_pool_shm_key
| innodb_buffer_pool_size
+---------------------------------+-------------+
3 rows in set (0.00 sec)