Skip to main content

my.cnf configuration because of high cpu usage from mysql

Comments

4 comments

  • Unnamed User

    on /var/log/mysql-slow.log, i found this query running again and again:

    # Time: 2024-07-29T05:32:55.323554Z
    # User@Host: root[root] @ localhost []  Id: 652936
    # Query_time: 172.102876  Lock_time: 0.074250 Rows_sent: 121  Rows_examined: 74186
    SET timestamp=1722231003;
    SELECT TABLE_SCHEMA as DB,SUM(DATA_LENGTH)+SUM(INDEX_LENGTH) AS SPACEUSED from information_schema.tables WHERE TABLE_TYPE NOT LIKE '%view%' GROUP BY TABLE_SCHEMA;

    in tweak setting i disabled "Use INFORMATION_SCHEMA to acquire database disk usage" and waiting for any change in server load and cpu use

    0
  • Unnamed User

    From WHM > Process Manager after i "killed" mysql process cpu was around 28% and server load about 1.14
    And an hour later, the cpu usage is up to 105% (server load 5.82) and still going up.
    until next kill process.

     

    0
  • mtindor

    Maybe those sites using up the CPU (see the php-fpm entries) are what is taxing MySQL.

    mysqladmin processlist # run this when you are seeing the high load -- to see what is hitting MySQL

    0
  • Guru Sethi

    Your configuration looks solid, but a few improvements could optimize performance:

    1. Query Cache: The query_cache_size=100M is commented out. While query caching can improve read-heavy workloads, it can increase CPU usage for write-heavy workloads, so enable it if your workload suits it.

    2. Slow Query Log: Enabling slow_query_log = 1 helps identify problematic queries but may increase CPU usage if a large number of queries exceed the long_query_time. You can adjust this setting based on the workload.

    3. Buffer Pool: Increase the innodb_buffer_pool_size to take advantage of your 64GB RAM. A size around 50-70% of RAM is recommended for better performance.

    0

Please sign in to leave a comment.