【问题标题】:mysqltuner recommendation suggestionmysqltuner推荐建议
【发布时间】:2015-07-30 09:20:39
【问题描述】:

问题:每当我运行 mysqltuner 时,它总是抱怨三个组件,即使我将它们的值更改为高但仍然显示需要更多,它们正在关注,我有两个表 MyISAMInnoDB,我们确实加入等还有,但我听说将join_buffer_size值设置得更高不好,以下是盒子的详细信息,请建议我的盒子是否还有什么要调整的?

Variables to adjust:
    query_cache_size (> 128M)
    join_buffer_size (> 4.0M, or always use indexes with joins)
    table_cache (> 512)

硬件: 40 CPUs64 GB Memory

MySQL: mysql-5.1.73-3.el6_5.x86_64

my.cnf

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
symbolic-links=0
bind-address    = 0.0.0.0

max_connections = 1000


max_allowed_packet=32M
join_buffer_size=4M
thread_cache_size=8

query_cache_limit=4M
query_cache_size=128M
thread_cache_size=4
table_cache=512
key_buffer_size=2G

innodb-buffer-pool-size = 16G
open-files-limit = 35535
sort_buffer_size = 6M
query-cache-type = 1

tmp_table_size=1G
innodb_log_buffer_size=1G

server-id=1
binlog-format   = mixed
log-bin=mysql-bin
datadir=/var/lib/mysql
innodb_flush_log_at_trx_commit=1
sync_binlog=1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

mysqltunner

-------- Performance Metrics -------------------------------------------------
[--] Up for: 18h 33m 52s (121M q [1K qps], 4M conn, TX: 32B, RX: 16B)
[--] Reads / Writes: 99% / 1%
[--] Total buffers: 19.1G global + 10.6M per thread (1000 max threads)
[OK] Maximum possible memory usage: 29.5G (46% of installed RAM)
[OK] Slow queries: 0% (4/121M)
[OK] Highest usage of available connections: 8% (88/1000)
[OK] Key buffer size / total MyISAM indexes: 2.0G/1.7G
[OK] Key buffer hit rate: 99.4% (15M cached / 90K reads)
[OK] Query cache efficiency: 71.1% (75M cached / 106M selects)
[!!] Query cache prunes per day: 27253282
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 21M sorts)
[!!] Joins performed without indexes: 12267
[OK] Temporary tables created on disk: 3% (1K on disk / 49K total)
[OK] Thread cache hit rate: 99% (1K created / 4M connections)
[!!] Table cache hit rate: 1% (365 open / 21K opened)
[OK] Open file limit used: 1% (449/35K)
[OK] Table locks acquired immediately: 99% (30M immediate / 30M locks)
[OK] InnoDB data size / buffer pool: 115.6M/16.0G

-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    Enable the slow query log to troubleshoot bad queries
    Adjust your join queries to always utilize indexes
    Increase table_cache gradually to avoid file descriptor limits
Variables to adjust:
    query_cache_size (> 128M)
    join_buffer_size (> 4.0M, or always use indexes with joins)
    table_cache (> 512)

状态

mysql> show status LIKE '%open_%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| Com_show_open_tables     | 0     |
| Open_files               | 449   |
| Open_streams             | 0     |
| Open_table_definitions   | 169   |
| Open_tables              | 365   |
| Opened_files             | 7436  |
| Opened_table_definitions | 0     |
| Opened_tables            | 0     |
| Slave_open_temp_tables   | 0     |
+--------------------------+-------+
9 rows in set (0.00 sec)

mysql> show status LIKE '%key_%';
+------------------------+----------+
| Variable_name          | Value    |
+------------------------+----------+
| Com_assign_to_keycache | 0        |
| Com_preload_keys       | 0        |
| Com_show_keys          | 0        |
| Key_blocks_not_flushed | 0        |
| Key_blocks_unused      | 1617830  |
| Key_blocks_used        | 96906    |
| Key_read_requests      | 15325797 |
| Key_reads              | 91041    |
| Key_write_requests     | 497292   |
| Key_writes             | 421837   |
+------------------------+----------+
10 rows in set (0.00 sec)

注意事项:我们每晚运行 mysqldump。

【问题讨论】:

  • 为 InnoDB 日志缓冲区分配 1GB 内存似乎是一种浪费。 innodb 日志文件有多大,它们需要那么大吗?
  • 我们不知道,实际上我们在性能方面遇到了一些问题,并且遇到了一些建议将innodb_log_buffer_size=1G 放入的 POST,那么您认为我们应该使用什么?

标签: mysql database tunneling mysqltuner


【解决方案1】:

mysqltuner 正在输出: MySQL 在过去 24 小时内启动 - 建议可能不准确

请确保已完成足够多的请求以确保 mysqltuner 准确地为您提供建议。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-16
    • 1970-01-01
    • 2011-04-14
    • 2010-12-23
    • 2010-10-02
    • 1970-01-01
    相关资源
    最近更新 更多