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.

Need help optimising my.cnf Mysql

Discussion in 'Workarounds and Optimization' started by mmarhama, Jun 1, 2017.

  1. mmarhama

    mmarhama Registered

    Joined:
    Jun 1, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Bahrain
    cPanel Access Level:
    Root Administrator
    Hi, am not sure what to write in my.cnf, attach is mysqltuner report, please advice what to add in my.cnf
    Code:
    -------- Performance Metrics -----------------------------------------------------------------------
    [--] Up for: 2h 18m 33s (1M q [137.757 qps], 6K conn, TX: 19G, RX: 643M)
    [--] Reads / Writes: 94% / 6%
    [--] Binary logging is disabled
    [--] Physical Memory : 49.0G
    [--] Max MySQL memory : 836.0M
    [--] Other process memory: 1.0G
    [--] Total buffers: 416.0M global + 2.8M per thread (151 max threads)
    [--] P_S Max memory usage: 0B
    [--] Galera GCache Max memory usage: 0B
    [OK] Maximum reached memory usage: 435.5M (0.87% of installed RAM)
    [OK] Maximum possible memory usage: 836.0M (1.67% of installed RAM)
    [OK] Overall possible memory usage with other process is compatible with memory available
    [OK] Slow queries: 0% (0/1M)
    [OK] Highest usage of available connections: 4% (7/151)
    [OK] Aborted connections: 0.02% (1/6592)
    [!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance
    [!!] Query cache may be disabled by default due to mutex contention.
    [!!] Query cache efficiency: 0.0% (0 cached / 1M selects)
    [OK] Query cache prunes per day: 0
    [OK] Sorts requiring temporary tables: 0% (266 temp sorts / 225K sorts)
    [OK] No joins without indexes
    [!!] Temporary tables created on disk: 81% (218K on disk / 268K total)
    [!!] Thread cache is disabled
    [OK] Table cache hit rate: 153% (158 open / 103 opened)
    [OK] Open file limit used: 1% (125/10K)
    [OK] Table locks acquired immediately: 100% (1M immediate / 1M locks)
    
    -------- Performance schema ------------------------------------------------------------------------
    [--] Performance schema is disabled.
    [--] Memory used by P_S: 0B
    [--] Sys schema isn't installed.
    
    -------- ThreadPool Metrics ------------------------------------------------------------------------
    [--] ThreadPool stat is enabled.
    [--] Thread Pool Size: 10 thread(s).
    [--] Using default value is good enough for your version (10.0.31-MariaDB)
    
    -------- MyISAM Metrics ----------------------------------------------------------------------------
    [!!] Key buffer used: 18.7% (25M used / 134M cache)
    [OK] Key buffer size / total MyISAM indexes: 128.0M/18.3M
    [OK] Read Key buffer hit rate: 99.9% (447K cached / 292 reads)
    [OK] Write Key buffer hit rate: 98.6% (25K cached / 25K writes)
    
    -------- InnoDB Metrics ----------------------------------------------------------------------------
    [--] InnoDB is enabled.
    [--] InnoDB Thread Concurrency: 0
    [OK] InnoDB File per table is activated
    [!!] InnoDB buffer pool / data size: 128.0M/1.6G
    [!!] Ratio InnoDB log file size / InnoDB Buffer pool size (75 %): 48.0M * 2/128.0M should be equal 25%
    [!!] InnoDB buffer pool <= 1G and Innodb_buffer_pool_instances(!=1).
    [--] InnoDB Buffer Pool Chunk Size not used or defined in your version
    [OK] InnoDB Read buffer efficiency: 98.69% (2290994126 hits/ 2321482987 total)
    [!!] InnoDB Write Log efficiency: 47.76% (46589 hits/ 97538 total)
    [OK] InnoDB log waits: 0.00% (0 waits / 50949 writes)
    
    -------- AriaDB Metrics ----------------------------------------------------------------------------
    [--] AriaDB is enabled.
    [OK] Aria pagecache size / total Aria indexes: 128.0M/1B
    [OK] Aria pagecache hit rate: 99.7% (15M cached / 51K reads)
    
    -------- TokuDB Metrics ----------------------------------------------------------------------------
    [--] TokuDB is disabled.
    
    -------- XtraDB Metrics ----------------------------------------------------------------------------
    [--] XtraDB is disabled.
    
    -------- RocksDB Metrics ---------------------------------------------------------------------------
    [--] RocksDB is disabled.
    
    -------- Spider Metrics ----------------------------------------------------------------------------
    [--] Spider is disabled.
    
    -------- Connect Metrics ---------------------------------------------------------------------------
    [--] Connect is disabled.
    
    -------- Galera Metrics ----------------------------------------------------------------------------
    [--] Galera is disabled.
    
    -------- Replication Metrics -----------------------------------------------------------------------
    [--] Galera Synchronous replication: NO
    [--] No replication slave(s) for this server.
    [--] This is a standalone server.
    
    -------- Recommendations ---------------------------------------------------------------------------
    General recommendations:
    Control warning line(s) into /var/lib/mysql/vmi116126.contaboserver.net.err file
    Control error line(s) into /var/lib/mysql/vmi116126.contaboserver.net.err file
    MySQL started within last 24 hours - recommendations may be inaccurate
    Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries which have no LIMIT clause
    Set thread_cache_size to 4 as a starting value
    Performance should be activated for better diagnostics
    Consider installing Sys schema from GitHub - mysql/mysql-sys: The MySQL sys schema
    Variables to adjust:
    query_cache_size (=0)
    query_cache_type (=0)
    query_cache_limit (> 1M, or use smaller result sets)
    tmp_table_size (> 16M)
    max_heap_table_size (> 16M)
    thread_cache_size (start at 4)
    performance_schema = ON enable PFS
    innodb_buffer_pool_size (>= 1G) if possible.
    innodb_log_file_size * innodb_log_files_in_group should be equal to 1/4 of buffer pool size (=64M) if possible.
    innodb_buffer_pool_instances (=1)
    
    Code:
    MySQLTuner 1.7.2 - Major Hayden major@mhtx.net
    Bug reports, feature requests, and downloads at http://mysqltuner.com/
    Run with '--help' for additional options and output filtering
    
    [--] Skipped version check for MySQLTuner script
    [!!] Currently running unsupported MySQL version 10.0.31-MariaDB
    [OK] Operating on 64-bit architecture
    
     
    #1 mmarhama, Jun 1, 2017
    Last edited by a moderator: Jun 1, 2017
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,280
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I'll leave this thread open for additional user-feedback, but I do want to recommend letting MySQL run for at least 24 hours before running the tuning script to ensure you receive accurate results.

    Thank you.
     
  3. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,400
    Likes Received:
    52
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    Yes, Michael is right, in fact the tuner or the primer script that you execute for MySQL also gives the same recommendation at the top when it starts calculating (24-48 hours) is necessary, so all the values come into play at that time would be analyzed and calculation would be go towards being more accurate (not 100%) but quite near to it..
     
  4. mmarhama

    mmarhama Registered

    Joined:
    Jun 1, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Bahrain
    cPanel Access Level:
    Root Administrator
    Ok great, will send you the report within the time, the VPS is 10 cros e5, 50GB ram, SSD 1200GB.
    Is this the best optimization for mysql or there are other method to increase the performances and speed?

    Currently, we are running wp with 35k products, and the perfromances is very slow, also the api to mysql takes 5 - 9 sec to fetch the data, so i was searching the google for optimizing or speeding up this api connection to mysql.

    I have spoken to many of sys admin, they requested me to change to mariadb, memcatche etc, and I did that, but the speed is the same?

    other sys admin, requested to go without cpanel, since cpanel is not made for such performances, only to go with phpmyadmin, mysql and mail server, still i didnt do that, cause am not fammiliar to work on coding SSH.

    any suggestions?
     
  5. mmarhama

    mmarhama Registered

    Joined:
    Jun 1, 2017
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Bahrain
    cPanel Access Level:
    Root Administrator
    This report after 24 hrs, please advice best config

    Code:
    [--] Skipped version check for MySQLTuner script
    [!!] Currently running unsupported MySQL version 10.0.31-MariaDB
    [OK] Operating on 64-bit architecture
    
    -------- Log file Recommendations ------------------------------------------------------------------
    [--] Log file: /var/lib/mysql/vmi116126.example.net.err(311K)
    [OK] Log file /var/lib/mysql/vmi116126.example.net.err exists
    [OK] Log file /var/lib/mysql/vmi116126.example.net.err is readable.
    [OK] Log file /var/lib/mysql/vmi116126.example.net.err is not empty
    [OK] Log file /var/lib/mysql/vmi116126.example.net.err is smaller than 32 Mb
    [!!] /var/lib/mysql/vmi116126.example.net.err contains 453 warning(s).
    [!!] /var/lib/mysql/vmi116126.example.net.err contains 588 error(s).
    [--] 38 start(s) detected in /var/lib/mysql/vmi116126.example.net.err
    [--] 1) 170601 23:12:37 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 2) 170601 23:11:23 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 3) 170601 23:09:54 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 4) 170601 23:09:50 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 5) 170601 23:09:19 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 6) 170601 18:20:20 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 7) 170601 15:36:49 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 8) 170601 12:04:34 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 9) 170601 12:04:24 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 10) 170601 10:16:17 [Note] /usr/sbin/mysqld: ready for connections.
    [--] 40 shutdown(s) detected in /var/lib/mysql/vmi116126.contaboserver.net.err
    [--] 1) 170601 23:12:36 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 2) 170601 23:11:22 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 3) 170601 23:09:53 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 4) 170601 23:09:49 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 5) 170601 23:08:34 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 6) 170601 23:08:28 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 7) 170601 23:08:22 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 8) 170601 23:07:40 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 9) 170601 23:07:34 [Note] /usr/sbin/mysqld: Shutdown complete
    [--] 10) 170601 23:07:28 [Note] /usr/sbin/mysqld: Shutdown complete
    
    -------- Storage Engine Statistics -----------------------------------------------------------------
    [--] Status: +ARCHIVE +Aria +BLACKHOLE +CSV +FEDERATED +InnoDB +MEMORY +MRG_MyISAM +MyISAM +PERFORMANCE_SCHEMA
    [--] Data in MyISAM tables: 317M (Tables: 105)
    [--] Data in InnoDB tables: 1G (Tables: 72)
    [OK] Total fragmented tables: 0
    
    -------- Security Recommendations ------------------------------------------------------------------
    [OK] There are no anonymous accounts for any database users
    [OK] All database users have passwords assigned
    [!!] There is no basic password file list!
    
    -------- CVE Security Recommendations --------------------------------------------------------------
    [--] Skipped due to --cvefile option undefined
    
    -------- Performance Metrics -----------------------------------------------------------------------
    [--] Up for: 1d 1h 14m 45s (10M q [119.176 qps], 49K conn, TX: 153G, RX: 5G)
    [--] Reads / Writes: 94% / 6%
    [--] Binary logging is disabled
    [--] Physical Memory : 49.0G
    [--] Max MySQL memory : 836.0M
    [--] Other process memory: 1.1G
    [--] Total buffers: 416.0M global + 2.8M per thread (151 max threads)
    [--] P_S Max memory usage: 0B
    [--] Galera GCache Max memory usage: 0B
    [OK] Maximum reached memory usage: 435.5M (0.87% of installed RAM)
    [OK] Maximum possible memory usage: 836.0M (1.67% of installed RAM)
    [OK] Overall possible memory usage with other process is compatible with memory available
    [OK] Slow queries: 0% (7/10M)
    [OK] Highest usage of available connections: 4% (7/151)
    [OK] Aborted connections: 0.02% (10/49095)
    [!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance
    [!!] Query cache may be disabled by default due to mutex contention.
    [!!] Query cache efficiency: 0.0% (0 cached / 9M selects)
    [OK] Query cache prunes per day: 0
    [OK] Sorts requiring temporary tables: 0% (3K temp sorts / 1M sorts)
    [OK] No joins without indexes
    [!!] Temporary tables created on disk: 76% (1M on disk / 1M total)
    [!!] Thread cache is disabled
    [OK] Table cache hit rate: 95% (298 open / 312 opened)
    [OK] Open file limit used: 2% (280/10K)
    [OK] Table locks acquired immediately: 99% (14M immediate / 14M locks)
    
    -------- Performance schema ------------------------------------------------------------------------
    [--] Performance schema is disabled.
    [--] Memory used by P_S: 0B
    [--] Sys schema isn't installed.
    
    -------- ThreadPool Metrics ------------------------------------------------------------------------
    [--] ThreadPool stat is enabled.
    [--] Thread Pool Size: 10 thread(s).
    [--] Using default value is good enough for your version (10.0.31-MariaDB)
    
    -------- MyISAM Metrics ----------------------------------------------------------------------------
    [!!] Key buffer used: 19.8% (26M used / 134M cache)
    [OK] Key buffer size / total MyISAM indexes: 128.0M/17.7M
    [OK] Read Key buffer hit rate: 100.0% (13M cached / 773 reads)
    [!!] Write Key buffer hit rate: 67.9% (314K cached / 213K writes)
    
    -------- InnoDB Metrics ----------------------------------------------------------------------------
    [--] InnoDB is enabled.
    [--] InnoDB Thread Concurrency: 0
    [OK] InnoDB File per table is activated
    [!!] InnoDB buffer pool / data size: 128.0M/1.6G
    [!!] Ratio InnoDB log file size / InnoDB Buffer pool size (75 %): 48.0M * 2/128.0M should be equal 25%
    [!!] InnoDB buffer pool <= 1G and Innodb_buffer_pool_instances(!=1).
    [--] InnoDB Buffer Pool Chunk Size not used or defined in your version
    [OK] InnoDB Read buffer efficiency: 98.28% (20202356856 hits/ 20556730428 total)
    [!!] InnoDB Write Log efficiency: 47.23% (354056 hits/ 749676 total)
    [OK] InnoDB log waits: 0.00% (0 waits / 395620 writes)
    
    -------- AriaDB Metrics ----------------------------------------------------------------------------
    [--] AriaDB is enabled.
    [OK] Aria pagecache size / total Aria indexes: 128.0M/1B
    [OK] Aria pagecache hit rate: 99.8% (176M cached / 324K reads)
    
    -------- TokuDB Metrics ----------------------------------------------------------------------------
    [--] TokuDB is disabled.
    
    -------- XtraDB Metrics ----------------------------------------------------------------------------
    [--] XtraDB is disabled.
    
    -------- RocksDB Metrics ---------------------------------------------------------------------------
    [--] RocksDB is disabled.
    
    -------- Spider Metrics ----------------------------------------------------------------------------
    [--] Spider is disabled.
    
    -------- Connect Metrics ---------------------------------------------------------------------------
    [--] Connect is disabled.
    
    -------- Galera Metrics ----------------------------------------------------------------------------
    [--] Galera is disabled.
    
    -------- Replication Metrics -----------------------------------------------------------------------
    [--] Galera Synchronous replication: NO
    [--] No replication slave(s) for this server.
    [--] This is a standalone server.
    
    -------- Recommendations ---------------------------------------------------------------------------
    General recommendations:
    Control warning line(s) into /var/lib/mysql/vmi116126.contaboserver.net.err file
    Control error line(s) into /var/lib/mysql/vmi116126.contaboserver.net.err file
    Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
    When making adjustments, make tmp_table_size/max_heap_table_size equal
    Reduce your SELECT DISTINCT queries which have no LIMIT clause
    Set thread_cache_size to 4 as a starting value
    Performance should be activated for better diagnostics
    Consider installing Sys schema from GitHub - mysql/mysql-sys: The MySQL sys schema
    Variables to adjust:
    query_cache_size (=0)
    query_cache_type (=0)
    query_cache_limit (> 1M, or use smaller result sets)
    tmp_table_size (> 16M)
    max_heap_table_size (> 16M)
    thread_cache_size (start at 4)
    performance_schema = ON enable PFS
    innodb_buffer_pool_size (>= 1G) if possible.
    innodb_log_file_size * innodb_log_files_in_group should be equal to 1/4 of buffer pool size (=64M) if possible.
    innodb_buffer_pool_instances (=1)
    
    
     
    #5 mmarhama, Jun 2, 2017
    Last edited by a moderator: Jun 2, 2017
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,037
    Likes Received:
    1,280
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You could try adding/modifying the values in your /etc/my.cnf file based on the "Variables to adjust" output. You may also want to consult with a system administrator if you would like additional help tuning the MySQL configuration:

    System Administration Services | cPanel Forums

    Thank you.
     
Loading...

Share This Page