码迷,mamicode.com
首页 > 数据库 > 详细

mysql 性能监控

时间:2018-12-22 12:01:29      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:connected   最大并发数   repair   内存   pair   one   pool   enc   sleep   

1、监控thread_cache命中率
admin@localhost : (none) 07:51:20> show variables like ‘%thread%‘;
+---------------------------------------+---------------------------+
| Variable_name                         | Value                     |
+---------------------------------------+---------------------------+
| innodb_read_io_threads                | 1                         |
| innodb_thread_concurrency             | 0                         |
| innodb_thread_concurrency_timer_based | OFF                       |
| innodb_thread_sleep_delay             | 10000                     |
| innodb_use_purge_thread               | 8                         |
| innodb_write_io_threads               | 16                        |
| max_delayed_threads                   | 20                        |
| max_insert_delayed_threads            | 20                        |
| myisam_repair_threads                 | 1                         |
| pseudo_thread_id                      | 2919973                   |
| thread_cache_size                     | 512                       |
| thread_handling                       | one-thread-per-connection |
| thread_stack                          | 262144                    |
| thread_statistics                     | OFF                       |
+---------------------------------------+---------------------------+
14 rows in set (0.00 sec)
  说明:可以看出thread_cahce池中最大可以放512个连接线程,每个线程分配262144/512=512K内存空间

admin@localhost : (none) 07:50:50> show status like ‘%connection%‘;
+----------------------+---------+
| Variable_name        | Value   |
+----------------------+---------+
| Connections          | 2920267 |
| Max_used_connections | 1008    |
+----------------------+---------+
2 rows in set (0.01 sec)
 
admin@localhost : (none) 07:51:08> show status like ‘%thread%‘;
+----------------------------+-------+
| Variable_name              | Value |
+----------------------------+-------+
| Com_show_thread_statistics | 0     |
| Delayed_insert_threads     | 0     |
| Slow_launch_threads        | 0     |
| Threads_cached             | 219   |
| Threads_connected          | 790   |
| Threads_created            | 2821  |
| Threads_running            | 4   
  |
+----------------------------+-------+
7 rows in set (0.00 sec)
从上可以看出到目前为止服务器共有2920267 次连接,最大并发数为1008,当前thread_cahce中连接有219个,连接数为790个,共创建了2821次连接,当前活跃的有4个
  利用公式可以计算出thread_chace的命中率 :(Connections - Threads_created)/Connections *100=99.9%

2、监控innodb cache
admin@localhost : (none) 08:08:24> show status like ‘%innodb_buffer_pool_read%‘;
+---------------------------------------+--------------+
| Variable_name                         | Value        |
+---------------------------------------+--------------+
| Innodb_buffer_pool_read_ahead_rnd     | 0            |
| Innodb_buffer_pool_read_ahead         | 1007126      |
| Innodb_buffer_pool_read_ahead_evicted | 938110       |
| Innodb_buffer_pool_read_requests      | 643795018139 |
| Innodb_buffer_pool_reads              | 24749326     |
+---------------------------------------+--------------+
5 rows in set (0.00 sec)
admin@localhost : (none) 08:08:32> show status like ‘%innodb_buffer_pool_wait%‘;
+------------------------------+-------+
| Variable_name                | Value |
+------------------------------+-------+
| 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                   | Value       |
+---------------------------------+-------------+
| innodb_buffer_pool_shm_checksum | ON          |
| innodb_buffer_pool_shm_key      | 0           |
| innodb_buffer_pool_size         | 23622320128 |
+---------------------------------+-------------+
3 rows in set (0.00 sec)

   说明:1 - (Innodb_buffer_pool_reads/Innodb_buffer_pool_read_requests)=1 - 24749326/643795018139 =3.84  说明innodb cache的命中率并不怎么高。

mysql 性能监控

标签:connected   最大并发数   repair   内存   pair   one   pool   enc   sleep   

原文地址:https://www.cnblogs.com/hehexu/p/10159871.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!