我从Scalr的AMI开始了一个服务器。 顶部不断显示我〜1.4。 我希望它和以前的所有服务器一样都是0。 服务器在ubuntu-10-04上运行mysql 5.1
在下面你可以findTOP输出。
服务器有什么问题? 我怎样才能找出什么东西在吃cpu?
编辑:这里是过程:
57 testuser 85.45.44.74:37833 cbar睡眠1299
63 testuser 85.45.44.74:40814 cbar睡眠81
64 testuser 85.45.44.74:40815 cbar Query 0显示完整的PROCESSLIST
这里是最大的记忆食物
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
根据上面的评论,它看起来像MySQL正在吃掉内存。 显示上面的完整进程列表,看看它是否在做任何事情,如果不是一个简单的MySQL重新启动可能会修复它。 如果仍然没有帮助,my.cnf的内容将帮助我们进一步诊断。
既然这是一个服务器,有没有其他机器正在向这个请求? 也许几分钟前有一阵外线电话。 这可能会占用MySQL的使用而不显示其他进程使用CPU。
既然你关心的是这台机器的顶部显示与其他机器之间的区别,这里的差异是什么:这是一台单独的处理器机器还是比其他机器更慢的磁盘? 或者这是一个不同的Ubuntu版本? 从这两个机器给cpuinfo和系统版本信息将解决这些问题。