The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MySQL Optimization for more traffic

Discussion in 'Workarounds and Optimization' started by ArnaudSImonetti, Sep 17, 2014.

  1. ArnaudSImonetti

    ArnaudSImonetti Registered

    Joined:
    Sep 17, 2014
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hello

    I have a problem with my configuration mysql.

    This is my configuration : 1x Intel® Xeon® E3 1230 v3 4 cœurs 8 threads @3.3 Ghz cache L3 8MB, x64, VT 32 Go DDR3 ECC link : - Removed -

    I have more trafic on my website if i share a post on my Facebook page. I have many Facebook page ( 12M total )

    When i have 3000 visit online, my website is very very slow ...

    This is my MySQLTuner :

    Code:
    -------- General Statistics --------------------------------------------------
    [--] Skipped version check for MySQLTuner script
    [OK] Currently running supported MySQL version 5.5.38-0+wheezy1
    [OK] Operating on 64-bit architecture
    
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
    [--] Data in InnoDB tables: 10M (Tables: 22)
    [--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
    [!!] Total fragmented tables: 22
    
    -------- Security Recommendations  -------------------------------------------
    [OK] All database users have passwords assigned
    
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 2h 35m 10s (698K q [75.009 qps], 11K conn, TX: 4B, RX: 78M)
    [--] Reads / Writes: 80% / 20%
    [--] Total buffers: 18.1G global + 18.6M per thread (3000 max threads)
    [!!] Maximum possible memory usage: 72.5G (231% of installed RAM)
    [OK] Slow queries: 0% (0/698K)
    [OK] Highest usage of available connections: 0% (15/3000)
    [OK] Key buffer size / total MyISAM indexes: 2.0G/97.0K
    [OK] Query cache efficiency: 87.7% (554K cached / 633K selects)
    [OK] Query cache prunes per day: 0
    [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 1K sorts)
    [!!] Joins performed without indexes: 6630
    [!!] Temporary tables created on disk: 28% (379 on disk / 1K total)
    [OK] Thread cache hit rate: 98% (227 created / 11K connections)
    [OK] Table cache hit rate: 21% (79 open / 374 opened)
    [OK] Open file limit used: 0% (48/81K)
    [OK] Table locks acquired immediately: 100% (81K immediate / 81K locks)
    [OK] InnoDB data size / buffer pool: 10.1M/4.0G
    
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Run OPTIMIZE TABLE to defragment tables for better performance
        MySQL started within last 24 hours - recommendations may be inaccurate
        Reduce your overall MySQL memory footprint for system stability
        Enable the slow query log to troubleshoot bad queries
        Adjust your join queries to always utilize indexes
        Temporary table size is already large - reduce result set size
        Reduce your SELECT DISTINCT queries without LIMIT clauses
    Variables to adjust:
      *** MySQL's maximum memory usage is dangerously high ***
      *** Add RAM before increasing MySQL buffer variables ***
        join_buffer_size (> 16.0M, or always use indexes with joins)
    
    This is a my my.cnf settings:

    Code:
    # The MySQL database server configuration file.
    
    # You can copy this to one of:
    # - "/etc/mysql/my.cnf" to set global options,
    # - "~/.my.cnf" to set user-specific options.
    #
    # One can use all long options that the program supports.
    # Run program with --help to get a list of available options and with
    # --print-defaults to see which it would actually understand and use.
    #
    # For explanations see
    # http://dev.mysql.com/doc/mysql/en/server-system-variables.html
    
    # This will be passed to all mysql clients
    # It has been reported that passwords should be enclosed with ticks/quotes
    # escpecially if they contain "#" chars...
    # Remember to edit /etc/mysql/debian.cnf when changing the socket location.
    [client]
    port            = 3306
    socket          = /var/run/mysqld/mysqld.sock
    
    # Here is entries for some specific programs
    # The following values assume you have at least 32M ram
    
    # This was formally known as [safe_mysqld]. Both versions are currently parsed.
    [mysqld_safe]
    socket          = /var/run/mysqld/mysqld.sock
    nice            = 0
    
    [mysqld]
    #
    # * Basic Settings
    #
    user            = mysql
    pid-file        = /var/run/mysqld/mysqld.pid
    socket          = /var/run/mysqld/mysqld.sock
    port            = 3306
    basedir         = /usr
    datadir         = /var/lib/mysql
    tmpdir          = /tmp
    lc-messages-dir = /usr/share/mysql
    skip-external-locking
    #
    # Instead of skip-networking the default is now to listen only on
    # localhost which is more compatible and is not less secure.
    bind-address            = 127.0.0.1
    #
    # * Fine Tuning
    #
    key_buffer              = 2G
    max_allowed_packet      = 64M
    thread_stack            = 192K
    thread_cache_size       = 8
    tmp_table_size = 4G
    max_heap_table_size = 4G
    open-files-limit = 81920
    join_buffer_size = 16M
    # This replaces the startup script and checks MyISAM tables if needed
    # the first time they are touched
    myisam-recover         = backup,force
    max_connections        = 3000
    table_cache            = 1024
    #thread_concurrency     = 10
    #
    # * Query Cache Configuration
    #
    query_cache_limit       = 2M
    query_cache_size        = 100M
    #
    # * Logging and Replication
    #
    # Both location gets rotated by the cronjob.
    # Be aware that this log type is a performance killer.
    # As of 5.1 you can enable the log at runtime!
    #general_log_file        = /var/log/mysql/mysql.log
    #general_log             = 1
    #
    # Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
    #
    # Here you can see queries with especially long duration
    #log_slow_queries       = /var/log/mysql/mysql-slow.log
    #long_query_time = 2
    #log-queries-not-using-indexes
    #
    # The following can be used as easy to replay backup logs or for replication.
    # note: if you are setting up a replication slave, see README.Debian about
    #       other settings you may need to change.
    #server-id              = 1
    #log_bin                        = /var/log/mysql/mysql-bin.log
    expire_logs_days        = 10
    max_binlog_size         = 500M
    #binlog_do_db           = include_database_name
    #binlog_ignore_db       = include_database_name
    #
    # * InnoDB
    #
    # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
    # Read the manual for more InnoDB related options. There are many!
    #
    
    innodb_buffer_pool_size        = 4G
    innodb_additional_mem_pool_size = 4G
    innodb_log_buffer_size = 4G
    innodb_write_io_threads=4
    innodb_read_io_threads=4
    
    # * Security Features
    #
    # Read the manual, too, if you want chroot!
    # chroot = /var/lib/mysql/
    #
    # For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
    #
    # ssl-ca=/etc/mysql/cacert.pem
    # ssl-cert=/etc/mysql/server-cert.pem
    # ssl-key=/etc/mysql/server-key.pem
    [mysqldump]
    quick
    quote-names
    max_allowed_packet      = 64M
    
    [mysql]
    #no-auto-rehash # faster start of mysql but no tab completition
    
    [isamchk]
    key_buffer              = 2G
    
    #
    # * IMPORTANT: Additional settings that can override those from this file!
    #   The files must end with '.cnf', otherwise they'll be ignored.
    #
    !includedir /etc/mysql/conf.d/
    

    What Can I do? Please give me some advise.
    Thank you very much,

    p.s: I'm so sorry, My English is not good.
     
    #1 ArnaudSImonetti, Sep 17, 2014
    Last edited by a moderator: Sep 17, 2014
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    648
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  3. ArnaudSImonetti

    ArnaudSImonetti Registered

    Joined:
    Sep 17, 2014
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Code:
    -------- General Statistics --------------------------------------------------
    [--] Skipped version check for MySQLTuner script
    [OK] Currently running supported MySQL version 5.5.38-0+wheezy1
    [OK] Operating on 64-bit architecture
    
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
    [--] Data in InnoDB tables: 11M (Tables: 22)
    [--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
    [!!] Total fragmented tables: 22
    
    -------- Security Recommendations  -------------------------------------------
    [OK] All database users have passwords assigned
    
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 1d 0h 52m 33s (1M q [106.092 qps], 124K conn, TX: 8B, RX: 150M)
    [--] Reads / Writes: 77% / 23%
    [--] Total buffers: 12.1G global + 18.6M per thread (3000 max threads)
    [!!] Maximum possible memory usage: 66.5G (212% of installed RAM)
    [OK] Slow queries: 0% (0/1M)
    [OK] Highest usage of available connections: 2% (82/3000)
    [OK] Key buffer size / total MyISAM indexes: 2.0G/97.0K
    [OK] Query cache efficiency: 89.2% (1M cached / 1M selects)
    [OK] Query cache prunes per day: 0
    [OK] Sorts requiring temporary tables: 0% (0 temp sorts / 2K sorts)
    [!!] Joins performed without indexes: 14249
    [!!] Temporary tables created on disk: 31% (688 on disk / 2K total)
    [OK] Thread cache hit rate: 97% (543 created / 124K connections)
    [OK] Table cache hit rate: 27% (76 open / 272 opened)
    [OK] Open file limit used: 0% (48/81K)
    [OK] Table locks acquired immediately: 100% (142K immediate / 142K locks)
    [OK] InnoDB data size / buffer pool: 11.0M/4.0G
    
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Run OPTIMIZE TABLE to defragment tables for better performance
        MySQL started within last 24 hours - recommendations may be inaccurate
        Reduce your overall MySQL memory footprint for system stability
        Enable the slow query log to troubleshoot bad queries
        Adjust your join queries to always utilize indexes
        Temporary table size is already large - reduce result set size
        Reduce your SELECT DISTINCT queries without LIMIT clauses
    Variables to adjust:
      *** MySQL's maximum memory usage is dangerously high ***
      *** Add RAM before increasing MySQL buffer variables ***
        join_buffer_size (> 16.0M, or always use indexes with joins)
     
Loading...

Share This Page