【问题标题】:Improve mysql database performance by performance metrics通过性能指标提高 mysql 数据库性能
【发布时间】:2016-10-24 05:10:11
【问题描述】:

我必须提高数据库性能,但我做不到,有人知道帮助我吗? 我需要解决,因为最近它很慢,我不能继续这样下去。 如果您需要更多信息,请告诉我

谢谢

-------- Performance Metrics -------------------------------------------------
[--] Up for: 1d 12h 31m 21s (174M q [1K qps], 357K conn, TX: 1706B, RX: 23B)
[--] Reads / Writes: 36% / 64%
[--] Binary logging is disabled
[--] Total buffers: 34.1G global + 56.2M per thread (350 max threads)
[OK] Maximum reached memory usage: 47.3G (75.17% of installed RAM)
[OK] Maximum possible memory usage: 53.4G (84.87% of installed RAM)
[OK] Slow queries: 0% (593/174M)
[OK] Highest usage of available connections: 68% (239/350)
[OK] Aborted connections: 0.13%  (465/357547)
[OK] Query cache efficiency: 70.6% (79M cached / 112M selects)
[!!] Query cache prunes per day: 194481
[OK] Sorts requiring temporary tables: 0% (72 temp sorts / 105K sorts)
[!!] Joins performed without indexes: 6417
[OK] Temporary tables created on disk: 1% (7K on disk / 727K total)
[OK] Thread cache hit rate: 99% (242 created / 357K connections)
[OK] Table cache hit rate: 98% (2K open / 2K opened)
[OK] Open file limit used: 0% (330/819K)
[OK] Table locks acquired immediately: 99% (99M immediate / 99M locks)

-------- MyISAM Metrics ------------------------------------------------------
[!!] Key buffer used: 18.3% (24M used / 134M cache)
[OK] Key buffer size / total MyISAM indexes: 128.0M/343.0K
[OK] Read Key buffer hit rate: 100.0% (290K cached / 42 reads)
[!!] Write Key buffer hit rate: 42.0% (128K cached / 74K writes)

-------- InnoDB Metrics ------------------------------------------------------
[--] InnoDB is enabled.
[!!] InnoDB buffer pool / data size: 32.0G/95.3G
[OK] InnoDB buffer pool instances: 32
[OK] InnoDB Used buffer: 100.00% (2097127 used/ 2097136 total)
[OK] InnoDB Read buffer efficiency: 99.99% (61258009301 hits/ 61262710249 total)
[!!] InnoDB Write buffer efficiency: 0.00% (0 hits/ 1 total)
[OK] InnoDB log waits: 0.00% (0 waits / 53278760 writes)

-------- ThreadPool Metrics --------------------------------------------------
[--] ThreadPool stat is disabled.

-------- AriaDB Metrics ------------------------------------------------------
[--] AriaDB is disabled.

-------- TokuDB Metrics ------------------------------------------------------
[--] TokuDB is disabled.

-------- Galera Metrics ------------------------------------------------------
[--] Galera is disabled.

-------- Replication Metrics -------------------------------------------------
[--] No replication slave(s) for this server.
[--] This is a standalone server..

-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    Restrict Host for user@% to user@SpecificDNSorIp
    Enable the slow query log to troubleshoot bad queries
    Increasing the query_cache size over 128M may reduce performance
    Adjust your join queries to always utilize indexes
Variables to adjust:
    query_cache_size (> 1G) [see warning above]
    join_buffer_size (> 32.0M, or always use indexes with joins)
    innodb_buffer_pool_size (>= 95G) if possible.

【问题讨论】:

  • 您是否优化了索引?
  • 在进行任何调整和更改 my.cnf 以更改 query_cache_size query_cache_limit 等之前,请调查 Joins performed without indexes 位。
  • 如何解决没有索引的连接?如何找到它? @phreakv6
  • @Jeroen 我只优化了表,我需要在使用连接查询时添加索引?
  • 您应该记录慢查询,然后对它们执行EXPLAIN 查询。请看dev.mysql.com/doc/refman/5.7/en/slow-query-log.html

标签: mysql performance config


【解决方案1】:

在列上添加适当的索引应该可以解决一半的问题。

【讨论】:

    猜你喜欢
    • 2023-03-08
    • 2017-05-23
    • 1970-01-01
    • 2019-11-12
    • 2010-10-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-13
    相关资源
    最近更新 更多