Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've been trying to figure out what is causing my VPS server to be always using 100% of RAM and a very high CPU usage by mysqld. I have ran the following commands through SSH and shared the highlights below:

mysqladmin watch processlist
Uptime: 474280  Threads: 3  Questions: 66972512  Slow queries: 13723144  Opens: 966  Flush tables: 1  Open tables: 899  Queries per second avg: 141.208

Top It shows a very high CPU usage (at times even more than 100%) for mysqld process.

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 3167 mysql      5 -10 3386m 721m 7040 S 312.2 35.3   9158:32 mysqld
    1 root      15   0 19232 1448 1212 S  0.0  0.1   0:33.31 init
 1241 root      14  -4 10644  584  324 S  0.0  0.0   0:00.00 udevd
 1714 root      18   0  179m 2776 1100 S  0.0  0.1   0:02.92 rsyslogd

Free -m This shows that there is no free memory available and 100% of the 2GB of memory is being used. buffers/cache seem to be using all of the memory

             total       used       free     shared    buffers     cached
Mem:          2048       2048          0          0          0          0
-/+ buffers/cache:       2048          0
Swap:            0          0          0

cat /proc/user_beancounters This shows that the resource 'kmemsize' is hogging nearly all of the 2GB memory as the 'held' amount is very close to the 'maxheld' amount.

Version: 2.5
       uid  resource                     held              maxheld              barrier                limit              failcnt
 10091594:  kmemsize                 24184616             24210131  9223372036854775807  9223372036854775807                    0
            lockedpages                     0                    0  9223372036854775807  9223372036854775807                    0
            privvmpages                810766               810838              1048576              1048576              2565103
            shmpages                     1192                 1192  9223372036854775807  9223372036854775807                    0
            dummy                           0                    0  9223372036854775807  9223372036854775807                    0
            numproc                        91                   91                32567                32567                    0
            physpages                  267316               267327  9223372036854775807  9223372036854775807                    0
            vmguarpages                     0                    0               524288  9223372036854775807                    0
            oomguarpages               267317               267328  9223372036854775807  9223372036854775807                    0
            numtcpsock                     29                   29  9223372036854775807  9223372036854775807                    0
            numflock                       10                   10  9223372036854775807  9223372036854775807                    0
            numpty                          1                    1                  255                  255                    0
            numsiginfo                     23                   23                 1024                 1024                    0
            tcpsndbuf                  842208               842208  9223372036854775807  9223372036854775807                    0
            tcprcvbuf                  475136               475136  9223372036854775807  9223372036854775807                    0
            othersockbuf               157216               157216  9223372036854775807  9223372036854775807                    0
            dgramrcvbuf                     0                    0  9223372036854775807  9223372036854775807                    0
            numothersock                   33                   34  9223372036854775807  9223372036854775807                    0
            dcachesize                1982229              1985046  9223372036854775807  9223372036854775807                    0
            numfile                      5017                 5026  9223372036854775807  9223372036854775807                    0
            dummy                           0                    0                    0                    0                    0
            dummy                           0                    0                    0                    0                    0
            dummy                           0                    0                    0                    0                    0
            numiptent                      10                   10  9223372036854775807  9223372036854775807                    0

cat /proc/meminfo This shows that the only place where the memory is being used is the 'LowTotal' is the same as the 'MemTotal'

MemTotal:      2097152 kB
MemFree:             0 kB
Buffers:             0 kB
Cached:              0 kB
SwapCached:          0 kB
Active:              0 kB
Inactive:            0 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:      2097152 kB
LowFree:             0 kB
SwapTotal:           0 kB
SwapFree:            0 kB
Dirty:            8320 kB

vmstat vmstat monitor shows that the system never has any free memory. buff and cache are always empty.

procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0      0      0      0      0    0    0     2    84    0   11 14  2 85  0  0
share|improve this question
    
"buffers/cache seem to be using all of the memory" <---- that's the way it should be. –  EEAA Aug 7 '13 at 21:13
1  
OK, so show us the actual data. –  Michael Hampton Aug 7 '13 at 21:33
    
Uptime: 474280 Threads: 3 Questions: 66972512 Slow queries: 13723144 Opens: 966 Flush tables: 1 Open tables: 899 Queries per second avg: 141.208 –  Faddy Aug 7 '13 at 22:46
    
Do a mysqladmin --verbose processlist and examine the queries. –  HTTP500 Aug 8 '13 at 2:01
    
For the memory "problem": just get more memory! –  HTTP500 Aug 8 '13 at 2:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.