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

I've started a server from Scalr's AMIs. Top shows me ~1.4 constantly. I expect it to be 0 as in all the previous servers I worked with. The server runs mysql 5.1 on ubuntu-10-04

Below you can find the TOP output.

What is wrong with the server? How can I find out what is eating the cpu?

EDIT: Here are the processes:

57 testuser 85.45.44.74:37833 cbar Sleep 1299
63 testuser 85.45.44.74:40814 cbar Sleep 81
64 testuser 85.45.44.74:40815 cbar Query 0 SHOW FULL PROCESSLIST

AND HERE ARE THE TOP MEMORY EATERS

509 mysql     20   0  482m 370m 4084 S    0 21.3  17:25.74 mysqld
537 root      20   0 38060  12m 2096 S    0  0.7   0:00.20 scalarizr
471 root      20   0 57432  11m 2964 S    0  0.7   0:00.32 scalarizr
514 root      20   0  8776 3008 2340 S    0  0.2   0:00.14 sshd
585 root      20   0 20940 2916 1832 S    0  0.2   0:00.02 console-kit-dae
1744 root      20   0  4588 1912 1524 S    0  0.1   0:00.02 bash
 1 root      20   0  2808 1392 1108 S    0  0.1   0:00.14 init
395 syslog    20   0 34672 1204  932 S    0  0.1   0:00.03 rsyslogd
1985 root      20   0  2540 1188  940 R    0  0.1   0:00.00 top
 476 root      20   0  2400  924  732 S    0  0.1   0:00.00 cron
 419 root      20   0  5572  852  532 S    0  0.0   0:00.00 sshd

-

Jtop - 15:32:19 up  3:33,  1 user,  load average: 1.28, 1.28, 1.22
Tasks:  76 total,   1 running,  75 sleeping,   0 stopped,   0 zombie
Cpu(s):  4.0%us,  0.4%sy,  0.0%ni, 93.0%id,  2.1%wa,  0.0%hi,  0.0%si,  0.4%st
Mem:   1781976k total,  1715924k used,    66052k free,    13300k buffers
Swap:   917496k total,     1696k used,   915800k free,  1233484k cached

PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND            
1 root      20   0  2808 1392 1108 S    0  0.1   0:00.14 init               
2 root      20   0     0    0    0 S    0  0.0   0:00.00 kthreadd           
3 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/0        
4 root      20   0     0    0    0 S    0  0.0   0:00.00 ksoftirqd/0        
5 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/0         
6 root      20   0     0    0    0 S    0  0.0   0:00.01 events/0           
7 root      20   0     0    0    0 S    0  0.0   0:00.00 cpuset             
8 root      20   0     0    0    0 S    0  0.0   0:00.00 khelper            
9 root      20   0     0    0    0 S    0  0.0   0:00.00 netns              
10 root      20   0     0    0    0 S    0  0.0   0:00.00 async/mgr          
11 root      20   0     0    0    0 S    0  0.0   0:00.00 xenwatch           
12 root      20   0     0    0    0 S    0  0.0   0:00.00 xenbus             
14 root      RT   0     0    0    0 S    0  0.0   0:00.00 migration/1        
15 root      20   0     0    0    0 S    0  0.0   0:00.00 ksoftirqd/1        
16 root      RT   0     0    0    0 S    0  0.0   0:00.00 watchdog/1         
17 root      20   0     0    0    0 S    0  0.0   0:00.00 events/1           
18 root      20   0     0    0    0 S    0  0.0   0:00.00 sync_supers        
19 root      20   0     0    0    0 S    0  0.0   0:00.00 bdi-default        
20 root      20   0     0    0    0 S    0  0.0   0:00.00 kintegrityd/0      
21 root      20   0     0    0    0 S    0  0.0   0:00.00 kintegrityd/1      
22 root      20   0     0    0    0 S    0  0.0   0:00.00 kblockd/0          
23 root      20   0     0    0    0 S    0  0.0   0:00.00 kblockd/1          
24 root      20   0     0    0    0 S    0  0.0   0:00.00 kseriod            
27 root      20   0     0    0    0 S    0  0.0   0:00.00 khungtaskd         
29 root      20   0     0    0    0 S    0  0.0   0:00.95 kswapd0            
30 root      20   0     0    0    0 S    0  0.0   0:00.00 aio/0              
31 root      20   0     0    0    0 S    0  0.0   0:00.00 aio/1              
32 root      20   0     0    0    0 S    0  0.0   0:00.00 jfsIO              
33 root      20   0     0    0    0 S    0  0.0   0:00.00 jfsCommit          
34 root      20   0     0    0    0 S    0  0.0   0:00.00 jfsCommit          
35 root      20   0     0    0    0 S    0  0.0   0:00.00 jfsSync            
36 root      20   0     0    0    0 S    0  0.0   0:00.00 xfs_mru_cache      
37 root      20   0     0    0    0 S    0  0.0   0:00.00 xfslogd/0          
38 root      20   0     0    0    0 S    0  0.0   0:00.00 xfslogd/1          
39 root      20   0     0    0    0 S    0  0.0   0:00.00 xfsdatad/0         
40 root      20   0     0    0    0 S    0  0.0   0:00.00 xfsdatad/1         
41 root      20   0     0    0    0 S    0  0.0   0:00.00 xfsconvertd/0      
42 root      20   0     0    0    0 S    0  0.0   0:00.00 xfsconvertd/1      
43 root      20   0     0    0    0 S    0  0.0   0:00.00 glock_workqueue    
44 root      20   0     0    0    0 S    0  0.0   0:00.00 glock_workqueue    
45 root      20   0     0    0    0 S    0  0.0   0:00.00 delete_workqueu    
46 root      20   0     0    0    0 S    0  0.0   0:00.00 delete_workqueu    
47 root      15  -5     0    0    0 S    0  0.0   0:00.00 kslowd000          
48 root      15  -5     0    0    0 S    0  0.0   0:00.00 kslowd001          
49 root      20   0     0    0    0 S    0  0.0   0:00.00 crypto/0           
50 root      20   0     0    0    0 S    0  0.0   0:00.00 crypto/1           
53 root      20   0     0    0    0 S    0  0.0   0:00.00 net_accel/0        
54 root      20   0     0    0    0 S    0  0.0   0:00.00 net_accel/1        
55 root      20   0     0    0    0 S    0  0.0   0:00.00 sfc_netfront/0     
56 root      20   0     0    0    0 S    0  0.0   0:00.00 sfc_netfront/1     
57 root      20   0     0    0    0 S    0  0.0   0:00.00 kstriped           
58 root      20   0     0    0    0 S    0  0.0   0:00.01 kjournald          
86 root      20   0  2340  628  624 S    0  0.0   0:00.05 upstart-udev-br    
88 root      16  -4  2340  344  340 S    0  0.0   0:00.03 udevd              
172 root      18  -2  2336  392  368 S    0  0.0   0:00.00 udevd              
173 root      18  -2  2336  308  304 S    0  0.0   0:00.00 udevd              
310 root      20   0     0    0    0 S    0  0.0   0:00.10 flush-8:1          
324 root      20   0  2256  140  136 S    0  0.0   0:00.00 dhclient3          
365 root      20   0     0    0    0 S    0  0.0   0:00.00 kjournald          
368 root      20   0     0    0    0 S    0  0.0   0:00.03 kjournald          
395 syslog    20   0 34672 1204  932 S    0  0.1   0:00.03 rsyslogd           
411 messageb  20   0  2688  776  644 S    0  0.0   0:00.00 dbus-daemon        
419 root      20   0  5572  852  532 S    0  0.0   0:00.00 sshd               
471 root      20   0 57432  11m 2964 S    0  0.7   0:00.28 scalarizr          
476 root      20   0  2400  924  732 S    0  0.1   0:00.00 cron               
477 daemon    20   0  2272  444  304 S    0  0.0   0:00.00 atd                
493 root       0 -20     0    0    0 S    0  0.0   0:00.00 loop0              
499 root      20   0     0    0    0 S    0  0.0   0:00.00 kjournald          
509 mysql     20   0  481m 368m 3760 S    0 21.2  17:24.94 mysqld             
514 root      20   0  8776 3008 2340 S    0  0.2   0:00.10 sshd               
537 root      20   0 38060  12m 2096 S    0  0.7   0:00.18 scalarizr          
585 root      20   0 20940 2916 1832 S    0  0.2   0:00.02 console-kit-dae    
763 root      20   0  1812  544  468 S    0  0.0   0:00.00 getty              
804 root      20   0  2024  660  544 S    0  0.0   0:00.00 sftp-server



#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port        = 3306
socket      = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice        = 0

[mysqld]
log_bin = /mnt/dbstorage/mysql-misc/binlog.log

#
# * Basic Settings
#

#
# * IMPORTANT
#   If you make changes to these settings and your system uses apparmor, you may
#   also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
#

user        = mysql
socket      = /var/run/mysqld/mysqld.sock
port        = 3306
basedir     = /usr
datadir     = /mnt/dbstorage/mysql-data/
tmpdir      = /tmp
skip-external-locking
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address       = 127.0.0.1
#
# * Fine Tuning
#
key_buffer      = 300M
max_allowed_packet  = 16M
thread_stack        = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
max_connections        = 200
max_heap_table_size = 50000000
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit   = 1M
query_cache_size        = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1

log_error                = /var/log/mysql/error.log

# Here you can see queries with especially long duration
#log_slow_queries   = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id      = 1
#log_bin            = /var/log/mysql/mysql-bin.log
expire_logs_days    = 10
max_binlog_size         = 100M
#binlog_do_db       = include_database_name
#binlog_ignore_db   = include_database_name
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
#
# * Security Features
#
# Read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem



[mysqldump]
quick
quote-names
max_allowed_packet  = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer      = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

!include /etc/mysql/farm-replication.cnf
share|improve this question
    
Hit Shift+m to sort by memory usage and paste again. I know load is typically CPU, but they're often related. –  James Lawrie Sep 1 '10 at 15:52
    
Also login to MySQL and do a Show Full Processlist; –  James Lawrie Sep 1 '10 at 15:53

2 Answers 2

Since this is a server, are there other machines that are making requests into this? Perhaps there was a flurry of outside calls a few minutes ago. That might account for the usage of mysql without showing other processes as using cpu.

Since you are concerned about the diff between what top shows in this versus other machines, what is the diff here: is this a single processor machine or a slower disk than the others? Or is this a different version of Ubuntu? Giving the cpuinfo and system version info from BOTH machines would address those questions.

share|improve this answer
    
The server is not connected to anything from outside besides mysql workbench (not running any queries) and terminal/ssh. It is a new server launched in a seperate farm without any outside access besides the regular scalr code. The server is supposed to replace a server I have in production with earlier version of ubuntu and mysql. There is no obvious reason for having any server load on it. –  Niro Sep 2 '10 at 5:10

As per the comments above, it looks like MySQL is eating up the memory. Show the full processlist above to see if it is doing anything, if not a simple MySQL restart might fix it. If it still doesn't help, the contents of my.cnf will help us diagnose further.

share|improve this answer
    
Please see edits above. I restarted the server. didnt change load average. –  Niro Sep 1 '10 at 16:23
    
I'm assuming you don't need those two queries running (in fact I'm surprised they're still running after a MySQL restart). Try (inside MySQL) kill query 37833; kill query 40814;, if that doesn't fix it it might be worth enabling MySQL logging to see what's going on. Also, anything different in my.cnf? –  James Lawrie Sep 1 '10 at 16:26
    
Thanks James! I ran SHOW FULL PROCESSLIST again and all I got is a process sleeping for 10 seconds (and the show precess list process). Top shows 1.14 load now. And the server is completely unused. I guess the two queries above are not the culprit. I'll try the logs. any advice on what to search for there? I'll attach my.cnf to the original post. –  Niro Sep 1 '10 at 20:15

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.