zoukankan      html  css  js  c++  java
  • MySQL性能建议者mysqltuner.pl和pt-variable-advisor

    [root@etch171 ~]# mysqltuner.pl --host 10.XXX --port XXX --user xxx --pass xxx --forcemem 128 
    
     >>  MySQLTuner 1.2.0 - Major Hayden <major@mhtx.net>
     >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
     >>  Run with '--help' for additional options and output filtering
    [--] Performing tests on 10.xxx:38xxx
    [OK] Logged in using credentials passed on the command line
    [--] Assuming 128 MB of physical memory
    [!!] Assuming 0 MB of swap space (use --forceswap to specify)
    
    -------- General Statistics --------------------------------------------------
    [--] Skipped version check for MySQLTuner script
    [OK] Currently running supported MySQL version 5.5.31-log
    
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
    [--] Data in MyISAM tables: 31M (Tables: 18)
    [--] Data in InnoDB tables: 913G (Tables: 131)
    [--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
    [!!] Total fragmented tables: 134
    
    -------- Security Recommendations  -------------------------------------------
    [OK] All database users have passwords assigned
    
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 14d 1h 24m 13s (114M q [94.201 qps], 28M conn, TX: 441B, RX: 36B)
    [--] Reads / Writes: 89% / 11%
    [--] Total buffers: 33.1G global + 128.2M per thread (3072 max threads)    
    [!!] Maximum possible memory usage: 417.9G (334293% of installed RAM)
    [OK] Slow queries: 0% (28K/114M)
    [OK] Highest usage of available connections: 5% (180/3072)
    [OK] Key buffer size / total MyISAM indexes: 256.0M/10.6M
    [OK] Key buffer hit rate: 100.0% (443K cached / 25 reads)
    [!!] Query cache efficiency: 8.3% (3M cached / 42M selects)
    [!!] Query cache prunes per day: 83423
    [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 120K sorts)
    [OK] Temporary tables created on disk: 0% (0 on disk / 239K total)
    [OK] Thread cache hit rate: 99% (2K created / 28M connections)
    [OK] Table cache hit rate: 98% (759 open / 771 opened)
    [OK] Open file limit used: 0% (39/204K)
    [OK] Table locks acquired immediately: 99% (43M immediate / 43M locks)
    [!!] InnoDB data size / buffer pool: 913.8G/32.0G
    
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Run OPTIMIZE TABLE to defragment tables for better performance
        Reduce your overall MySQL memory footprint for system stability
    Variables to adjust:
      *** MySQL's maximum memory usage is dangerously high ***
      *** Add RAM before increasing MySQL buffer variables ***
        query_cache_limit (> 2M, or use smaller result sets)
        query_cache_size (> 124M)
        innodb_buffer_pool_size (>= 913G)

    本机

    [root@typhoeus79 MySQLTuner-perl-master]# perl mysqltuner.pl --user root --pass  c0BsZjR57MgAGOk6IWZAMarVVg0 --socket /data1/guosong/mysql_5580/tmp/mysql.sock 
    
     >>  MySQLTuner 1.2.0 - Major Hayden <major@mhtx.net>
     >>  Bug reports, feature requests, and downloads at http://mysqltuner.com/
     >>  Run with '--help' for additional options and output filtering
    [OK] Logged in using credentials passed on the command line
    
    -------- General Statistics --------------------------------------------------
    [--] Skipped version check for MySQLTuner script
    [OK] Currently running supported MySQL version 5.5.8-log
    [OK] Operating on 64-bit architecture
    
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
    [--] Data in MyISAM tables: 116K (Tables: 2)
    [--] Data in InnoDB tables: 1G (Tables: 30)
    [--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
    [!!] Total fragmented tables: 5
    
    -------- Security Recommendations  -------------------------------------------
    [OK] All database users have passwords assigned
    
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 56d 14h 18m 18s (20K q [0.004 qps], 1K conn, TX: 886M, RX: 294M)
    [--] Reads / Writes: 78% / 22%
    [--] Total buffers: 696.0M global + 34.2M per thread (100 max threads)
    [OK] Maximum possible memory usage: 4.0G (25% of installed RAM)
    [OK] Slow queries: 0% (1/20K)
    [OK] Highest usage of available connections: 6% (6/100)
    [OK] Key buffer size / total MyISAM indexes: 32.0M/314.0K
    [OK] Key buffer hit rate: 99.5% (4K cached / 23 reads)
    [!!] Query cache efficiency: 1.4% (33 cached / 2K selects)
    [OK] Query cache prunes per day: 0
    [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 29 sorts)
    [OK] Temporary tables created on disk: 5% (16 on disk / 274 total)
    [OK] Thread cache hit rate: 99% (6 created / 1K connections)
    [OK] Table cache hit rate: 68% (75 open / 109 opened)
    [OK] Open file limit used: 0% (58/8K)
    [OK] Table locks acquired immediately: 100% (4K immediate / 4K locks)
    [!!] InnoDB data size / buffer pool: 1.3G/512.0M
    
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Run OPTIMIZE TABLE to defragment tables for better performance
    Variables to adjust:
        query_cache_limit (> 2M, or use smaller result sets)
        innodb_buffer_pool_size (>= 1G)

    pt-variable-advisor

    •# WARN innodb_flush_log_at_trx_commit-1: InnoDB is not configured in strictly ACID mode.
    •# NOTE innodb_max_dirty_pages_pct: The innodb_max_dirty_pages_pct is lower than the default.
    •# NOTE log_warnings-2: Log_warnings must be set greater than 1 to log unusual events such as
    aborted connections.
    •# NOTE max_connect_errors: max_connect_errors should probably be set as large as your
    platform allows.
    •# WARN sync_binlog: Binary logging is enabled, but sync_binlog isn't configured so that every transaction is flushed to the binary log for durability.

    http://www.percona.com/pdf-canonical-header?path=files/presentations/percona-live/dc-2012/PLDC2012-optimizing-mysql-configuration.pdf

     根据需求自动生成配置

  • 相关阅读:
    Spring 泛型依赖注入
    Spring 注解配置(2)——@Autowired
    Spring bean注解配置(1)
    Spring bean三种创建方式
    Spring中bean的生命周期!
    spring spel表达式语言
    [转]SVN版本冲突解决详解
    [转]Mybatis极其(最)简(好)单(用)的一个分页插件
    [转]Hibernate查询对象所有字段,单个字段 ,几个字段取值的问题
    [转] JPQL
  • 原文地址:https://www.cnblogs.com/gsblog/p/3488795.html
Copyright © 2011-2022 走看看