MySQL Server Usage Very High

Discussion in 'Server Operation' started by meamrussian, Jun 29, 2009.

  1. meamrussian

    meamrussian New Member

    Hello,

    First of all, I'm new here, so hello to you all!

    Whenever I run the "top" command, I see that some of the user "mysql" records always have very high CPU usage, anywhere from 20-80% on average (I've seen 100%). There are multiple records that show this, which means that the CPU is always above 100%. My cacti monitoring account also shows messed up CPU statistics.

    I am not too knowledgeable with servers, but I believe that this is a problem. How much CPU usage is a mysqld command supposed to use on average? Here is a copy of the top part of a sample top command:
    =========
    top - 06:54:50 up 92 days, 5:32, 1 user, load average: 3.82, 3.89, 4.24
    Tasks: 181 total, 4 running, 176 sleeping, 0 stopped, 1 zombie
    Cpu(s): 0.2%us, 18.6%sy, 80.9%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
    Mem: 2075600k total, 1905400k used, 170200k free, 331912k buffers
    Swap: 4096564k total, 104k used, 4096460k free, 1187304k cached

    PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
    21663 mysql 24 6 63032 30m 3004 R 66 1.5 38:24.06 mysqld
    28483 mysql 24 6 63032 30m 3004 R 66 1.5 35:52.86 mysqld
    20538 mysql 22 6 63032 30m 3004 S 15 1.5 40:29.74 mysqld
    20837 mysql 24 6 63032 30m 3004 R 15 1.5 13:44.15 mysqld
    1209 mysql 22 6 63032 30m 3004 S 11 1.5 32:46.26 mysqld
    20591 mysql 22 6 63032 30m 3004 S 11 1.5 40:02.76 mysqld
    20592 mysql 23 6 63032 30m 3004 S 6 1.5 40:48.29 mysqld
    15301 apache 19 4 29928 15m 3608 S 3 0.8 0:00.60 httpd
    15317 apache 19 4 28380 14m 3640 S 3 0.7 0:00.58 httpd
    15249 apache 19 4 28612 14m 3732 S 1 0.7 0:01.49 httpd
    15349 apache 19 4 28876 14m 3324 S 1 0.7 0:00.10 httpd
    15319 apache 19 4 28368 14m 3528 S 1 0.7 0:00.34 httpd
    15334 apache 19 4 28612 14m 3404 S 1 0.7 0:00.35 httpd
    12343 root 15 0 2324 1088 804 R 1 0.1 0:03.31 top
    15336 apache 19 4 28876 14m 3500 S 0 0.7 0:00.63 httpd
    1 root 15 0 2064 588 508 S 0 0.0 1:01.28 init
    2 root RT -5 0 0 0 S 0 0.0 0:09.39 migration/0
    3 root 34 19 0 0 0 S 0 0.0 0:01.25 ksoftirqd/0
    4 root RT -5 0 0 0 S 0 0.0 0:00.00 watchdog/0
    =================================
    I told my system manager about the cpu problem, and he said that he installed the cpulimit function on my server. I'm not sure if this is a good solution.

    Any tips or suggestions would be greatly appreciated.

    Thanks.
     
  2. falko

    falko Super Moderator Howtoforge Staff

Share This Page