High Load on CPU

Discussion in 'Site & Server Administration' started by a4tech, Apr 19, 2013.

  1. #1
    Hello, I see that high load on cpu. Server is with cPanel and RH OS. I see that MySQL Process List Time is increasing too much.

    Is there any way I can limit the time if a mysql query execute 50seconds than ok else drop the query or put it in sleep?

    Looking forward for reply.
    Thank You.
     
    a4tech, Apr 19, 2013 IP
  2. palsman

    palsman Active Member

    Messages:
    156
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    95
    #2
    Hi,

    you can limit this by adding this line in my.cnf file in your server:
    long_query_time = 50
    Code (markup):
    This is limits on query execution and that could actually impact performance a bit.
    but i thing this is value is too much.
     
    palsman, Apr 19, 2013 IP
  3. Techking

    Techking Well-Known Member

    Messages:
    611
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    130
    #3
    Install nginx in your server and it will drop load up to 60% !

    Best of Luck :)
     
    Techking, Apr 21, 2013 IP
  4. MilesWeb

    MilesWeb Well-Known Member

    Messages:
    869
    Likes Received:
    35
    Best Answers:
    7
    Trophy Points:
    173
    #4
    Optimize the parameters below in /etc/my.cnf as well. Will recommend you to set it at 40 secs.

    connect_timeout
    wait_timeout
    interactive_timeout
     
    MilesWeb, Apr 22, 2013 IP
  5. TiffanyJ.SSS

    TiffanyJ.SSS Member

    Messages:
    72
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    33
    #5
    Could also try the following for my.cnf

    [mysqld]
    default-storage-engine=MyISAM
    local-infile=0
    symbolic-links=0
    max_connections = 500
    key_buffer = 2048M
    myisam_sort_buffer_size = 256M
    join_buffer_size = 256M
    read_buffer_size = 256M
    sort_buffer_size = 256M
    read_rnd_buffer_size = 64M
    table_cache = 2048
    thread_cache_size = 16K
    wait_timeout = 60
    connect_timeout = 60
    tmp_table_size = 256M
    max_heap_table_size = 256M
    max_allowed_packet = 256M
    max_connect_errors = 15
    query_cache_limit = 32M
    query_cache_size = 256M
    query_cache_type = 1
    myisam_repair_threads=16
    innodb_force_recovery=6
    [mysqld_safe]
    open_files_limit = 8192
     
    [mysqldump]
    quick
    max_allowed_packet = 512M
     
    [myisamchk]
    key_buffer = 64M
    sort_buffer = 64M
    read_buffer = 16M
    write_buffer = 16M
    
    Code (markup):
    We run the following on all our share servers.
     
    TiffanyJ.SSS, Apr 22, 2013 IP
  6. |-:Bharat:-|

    |-:Bharat:-| Well-Known Member

    Messages:
    179
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    145
    #6
    Try using our values , maybe they can help . Place the below configuration into /etc/my.cnf and restart your mysql server to begin using the new configuration.

    [mysqld]
    #innodb_file_per_table=1
    default-storage-engine=MyISAM
    local-infile=0
     
    innodb_buffer_pool_size = 64M
    join_buffer_size = 2M
    key_buffer_size = 384M
    max_allowed_packet = 100M
    max_heap_table_size = 62M
    myisam_sort_buffer_size = 64M
    query_cache_limit = 2M
    query_cache_size = 64M
    read_buffer_size = 4M
    read_rnd_buffer_size = 8M
    sort_buffer_size = 4M
    table_cache = 612
    thread_cache_size = 32
    thread_concurrency = 32
    tmp_table_size = 64M
     
    tmpdir = /tmp
    open_files_limit = 51200
    Code (markup):
    You can make some changes on your apache as well make your sure httpd.conf (/etc/httpd/conf/httpd.conf) is not configured to start too many servers, or have to many spare server best weight loss sitting around.

    StartServers 1
    MinSpareServers 1
    MaxSpareServers 5
    ServerLimit 50
    MaxClients 50
    MaxRequestsPerChild 5000
    Code (markup):

    Also, make sure to adjust KeepAliveTimeout (to say, 2 or 3).

    The default configuration file for apache also frequently loads every module it can. Comment out any modules that aren't needed to save yourself some more memory.


    Hope it helps.
     
    |-:Bharat:-|, Apr 22, 2013 IP