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.

Optimizations for load spikes

Discussion in 'Workarounds and Optimization' started by zontrakulla, Dec 25, 2015.

  1. zontrakulla

    zontrakulla Active Member

    Joined:
    Jan 16, 2008
    Messages:
    39
    Likes Received:
    0
    Trophy Points:
    6
    Hello,

    I have a hosting server with around 100 users and sometimes mysql is using very high RAM.

    Can you please help me to adjust my configuration?

    Code:
    IntelCPU E3-1245 V2 @ 3.40GHz
    32 GB Ram
    
    my.cnf
    Code:
    [mysqld]
    innodb_file_per_table=1
    
    max_connections = 250
    
    
    large-pages
    innodb_use_sys_malloc = 0
    innodb_buffer_pool_size=2G
    large_pages = true
    
    query_cache_size=80M
    tmp_table_size=60M
    max_heap_table_size=60M
    key_buffer=64M
    thread_cache_size=32
    
    table_definition_cache = 1024
    
    key_buffer_size=6G
    log-slow-queries = /var/log/slowqueries
    long_query_time = 3
    log-slow-queries = /var/log/slowqueries
    long_query_time = 3
    max_allowed_packet=268435456
    open_files_limit=50000
    default-storage-engine=MyISAM
    
    Mysqltuner result
    Code:
    >>  MySQLTuner 1.3.0 - Major Hayden
    >>  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
    [OK] Currently running supported MySQL version 5.5.45-cll-lve
    [OK] Operating on 64-bit architecture
    
    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
    [--] Data in MyISAM tables: 2G (Tables: 12814)
    [--] Data in InnoDB tables: 841M (Tables: 11430)
    [--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
    [--] Data in MEMORY tables: 372K (Tables: 215)
    [!!] Total fragmented tables: 1097
    
    -------- Security Recommendations  -------------------------------------------
    [OK] All database users have passwords assigned
    
    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 14h 26m 3s (6M q [119.692 qps], 124K conn, TX: 33B, RX: 1B)
    [--] Reads / Writes: 81% / 19%
    [--] Total buffers: 8.2G global + 2.8M per thread (250 max threads)
    [OK] Maximum possible memory usage: 8.8G (28% of installed RAM)
    [OK] Slow queries: 0% (138/6M)
    [OK] Highest usage of available connections: 32% (80/250)
    [OK] Key buffer size / total MyISAM indexes: 6.0G/968.0M
    [OK] Key buffer hit rate: 96.4% (19M cached / 699K reads)
    [OK] Query cache efficiency: 64.4% (3M cached / 4M selects)
    [!!] Query cache prunes per day: 298179
    [OK] Sorts requiring temporary tables: 0% (152 temp sorts / 195K sorts)
    [!!] Joins performed without indexes: 4067
    [!!] Temporary tables created on disk: 34% (173K on disk / 500K total)
    [OK] Thread cache hit rate: 99% (114 created / 124K connections)
    [!!] Table cache hit rate: 0% (400 open / 258K opened)
    [OK] Open file limit used: 1% (560/50K)
    [OK] Table locks acquired immediately: 99% (2M immediate / 2M locks)
    [OK] InnoDB buffer pool / data size: 2.0G/841.8M
    [OK] InnoDB log waits: 0
    -------- Recommendations -----------------------------------------------------
    General recommendations:
        Run OPTIMIZE TABLE to defragment tables for better performance
        MySQL started within last 24 hours - recommendations may be inaccurate
        Adjust your join queries to always utilize indexes
        When making adjustments, make tmp_table_size/max_heap_table_size equal
        Reduce your SELECT DISTINCT queries without LIMIT clauses
        Increase table_cache gradually to avoid file descriptor limits
        Read this before increasing table_cache over 64: http://bit.ly/1mi7c4C
    Variables to adjust:
        query_cache_size (> 80M)
        join_buffer_size (> 128.0K, or always use indexes with joins)
        tmp_table_size (> 60M)
        max_heap_table_size (> 60M)
        table_cache (> 400)
    
    
    Thank you!
     
  2. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,146
    Likes Received:
    34
    Trophy Points:
    48
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hello :),

    I will suggest please try run Mysqltuner scripts on your server when you have more than 24 hours uptime of your mysql services and try to monitor your mysql server process list with "mysqladmin proc " command. With this command you will get all mysql process list with the database name and database user.
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Yes, I suggest running the "mysqladmin processlist" command when the memory usage is high to see if you can get a better idea about which database is utilizing the most resources.

    Thank you.
     
Loading...

Share This Page