PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : MySQL verursacht 99% CPU Auslastung--HILFE



TheLastOne
21.09.06, 16:30
Hallo,

habe da ein großes Problem, habe einen Rootserver P4 mit 3GHZ und 2GB RAM und suse 9.2
Darauf ist installiert nur Plesk. Er dient als reiner Webserver und es laufen 2 Große Seiten. Nun habe ich das Problem das er ständig unter vollast fährt.

Auszug:

top - 16:08:24 up 31 min, 1 user, load average: 1.49, 2.89, 5.47
Tasks: 113 total, 4 running, 109 sleeping, 0 stopped, 0 zombie
Cpu(s): 87.8% us, 7.3% sy, 0.0% ni, 4.7% id, 0.0% wa, 0.0% hi, 0.2% si
Mem: 2049348k total, 587592k used, 1461756k free, 46624k buffers
Swap: 1076312k total, 0k used, 1076312k free, 237956k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6379 mysql 15 0 140m 37m 4672 S 99.9 1.9 38:07.30 mysqld
9921 wwwrun 17 0 114m 18m 6984 R 7.6 0.9 0:00.66 httpd2-prefork
9970 wwwrun 16 0 114m 18m 6928 S 4.7 0.9 0:00.31 httpd2-prefork
9967 wwwrun 16 0 114m 18m 6972 R 3.7 0.9 0:00.36 httpd2-prefork
165 root 15 0 0 0 0 S 0.3 0.0 0:01.27 pdflush
9981 root 16 0 4284 1176 864 R 0.3 0.1 0:00.01 top
1 root 16 0 724 256 216 S 0.0 0.0 0:00.40 init
2 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/0
3 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
4 root RT 0 0 0 0 S 0.0 0.0 0:00.00 migration/1
5 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/1
6 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/0
7 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 events/1
8 root 10 -5 0 0 0 S 0.0 0.0 0:00.01 khelper
13 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kthread
26 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kacpid
120 root 10 -5 0 0 0 S 0.0 0.0 0:00.00 kblockd/0



Was verursacht sowas?

Also habe oben vergessen zusagen das nur MySQL dies verursacht, aber das seht Ihr ja selbst.

Für Lösungen würde ich mein Herz geben z.Z

Gruß
Daniel

PierreS
21.09.06, 16:47
MySQL selbst ist hier wahrscheinlich nicht das Problem, sondern die Scripte und ihre Abfragen. Die sind entweder schlecht programmiert oder der Server ist für die Aufgabe total unterdimensioniert. Gib mal mehr Infos zu den Diensten, die laufen, wieviele Besucher etc.

baumgartner
21.09.06, 16:52
Steht irgendwas in den Logs?

TheLastOne
21.09.06, 17:43
MySQL selbst ist hier wahrscheinlich nicht das Problem, sondern die Scripte und ihre Abfragen. Die sind entweder schlecht programmiert oder der Server ist für die Aufgabe total unterdimensioniert. Gib mal mehr Infos zu den Diensten, die laufen, wieviele Besucher etc.

Hallo,

Also die Seiten haben ca 8000 Besucher pro Tag und ca 100 sind gleichzeitig online.

Dienste:

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 724 256 ? S 15:36 0:00 init [3]
root 2 0.0 0.0 0 0 ? S 15:36 0:00 [migration/0]
root 3 0.0 0.0 0 0 ? SN 15:36 0:00 [ksoftirqd/0]
root 4 0.0 0.0 0 0 ? S 15:36 0:00 [migration/1]
root 5 0.0 0.0 0 0 ? SN 15:36 0:00 [ksoftirqd/1]
root 6 0.0 0.0 0 0 ? S< 15:36 0:00 [events/0]
root 7 0.0 0.0 0 0 ? S< 15:36 0:00 [events/1]
root 8 0.0 0.0 0 0 ? S< 15:36 0:00 [khelper]
root 13 0.0 0.0 0 0 ? S< 15:36 0:00 [kthread]
root 26 0.0 0.0 0 0 ? S< 15:36 0:00 [kacpid]
root 120 0.0 0.0 0 0 ? S< 15:36 0:00 [kblockd/0]
root 121 0.0 0.0 0 0 ? S< 15:36 0:00 [kblockd/1]
root 164 0.0 0.0 0 0 ? S 15:36 0:00 [pdflush]
root 165 0.0 0.0 0 0 ? S 15:36 0:04 [pdflush]
root 167 0.0 0.0 0 0 ? S< 15:36 0:00 [aio/0]
root 166 0.0 0.0 0 0 ? S 15:36 0:00 [kswapd0]
root 168 0.0 0.0 0 0 ? S< 15:36 0:00 [aio/1]
root 757 0.0 0.0 0 0 ? S 15:36 0:00 [kseriod]
root 932 0.0 0.0 0 0 ? S< 15:36 0:00 [ata/0]
root 933 0.0 0.0 0 0 ? S< 15:36 0:00 [ata/1]
root 939 0.0 0.0 0 0 ? S 15:36 0:00 [scsi_eh_0]
root 940 0.0 0.0 0 0 ? S 15:36 0:00 [scsi_eh_1]
root 941 0.0 0.0 0 0 ? S 15:36 0:00 [scsi_eh_2]
root 942 0.0 0.0 0 0 ? S 15:36 0:00 [scsi_eh_3]
root 1080 0.0 0.0 0 0 ? S 15:36 0:00 [md0_raid1]
root 1112 0.0 0.0 0 0 ? S< 15:36 0:01 [reiserfs/0]
root 1113 0.0 0.0 0 0 ? S< 15:36 0:01 [reiserfs/1]
root 2089 0.0 0.0 2552 660 ? S<s 15:36 0:00 /sbin/udevd -d
root 2122 0.0 0.0 0 0 ? S 15:36 0:00 [khpsbpkt]
root 2702 0.0 0.0 0 0 ? S 15:36 0:00 [khubd]
root 2709 0.0 0.0 2600 512 ? S< 15:36 0:00 [hwscand]
root 3716 0.0 0.0 2552 512 ? Ss 15:36 0:00 /usr/sbin/irqbalance
100 3742 0.0 0.0 14992 1608 ? Ss 15:36 0:00 /usr/bin/dbus-daemon-1 --system
root 3773 0.0 0.0 3608 548 ? Ss 15:36 0:00 /sbin/resmgrd
root 5747 0.0 0.0 9128 972 ? Ss 15:37 0:00 /sbin/syslog-ng
root 5781 0.0 0.0 2816 776 ? Ss 15:37 0:00 /sbin/klogd -c 1 -x -x
nobody 5805 0.0 0.0 4636 532 ? Ss 15:37 0:00 /sbin/portmap
root 5863 0.0 0.0 24172 1180 ? Ssl 15:37 0:00 /usr/sbin/nscd
root 5902 0.0 0.0 5908 684 ? Ss 15:37 0:00 /usr/sbin/cron
qmails 5920 0.0 0.0 2608 436 ? S 15:37 0:00 qmail-send
root 5922 0.0 0.1 14544 2564 ? Ss 15:37 0:00 /usr/sbin/hald --daemon=yes
qmaill 5924 0.0 0.0 2552 500 ? S 15:37 0:00 splogger qmail
root 5925 0.0 0.0 2592 400 ? S 15:37 0:00 qmail-lspawn ./Maildir/
qmailr 5926 0.0 0.0 2592 436 ? S 15:37 0:00 qmail-rspawn
qmailq 5927 0.0 0.0 2548 384 ? S 15:37 0:00 qmail-clean
root 6018 0.0 0.0 2556 592 ? Ss 15:37 0:00 /usr/sbin/acpid -c /etc/acpi/events.ignore
root 6048 0.0 0.1 25648 2256 ? Ss 15:37 0:00 /usr/sbin/sshd -o PidFile=/var/run/sshd.init.pid
root 6086 0.0 0.0 9220 1116 ? S 15:37 0:00 /usr/lib/courier-imap/couriertcpd -address=0 -stderrlogger=/usr/sbin/courierlogger -stderrlo
root 6090 0.0 0.0 6940 876 ? S 15:37 0:00 /usr/sbin/courierlogger imapd
root 6104 0.0 0.0 2580 508 ? Ss 15:37 0:00 /sbin/startpar -f -- qmail
root 6106 0.0 0.0 9220 1116 ? S 15:37 0:00 /usr/lib/courier-imap/couriertcpd -address=0 -stderrlogger=/usr/sbin/courierlogger -stderrlo
root 6108 0.0 0.0 6940 880 ? S 15:37 0:00 /usr/sbin/courierlogger imapd-ssl
root 6161 0.0 0.0 11444 1436 ? S 15:37 0:00 /usr/sbin/powersaved -d -x /usr/lib/powersave/scripts -a resmgr -v 3
root 6171 0.0 0.0 9220 1112 ? S 15:37 0:00 /usr/lib/courier-imap/couriertcpd -address=0 -stderrlogger=/usr/sbin/courierlogger -stderrlo
root 6175 0.0 0.0 6940 880 ? S 15:37 0:00 /usr/sbin/courierlogger pop3d
root 6185 0.0 0.0 9220 1116 ? S 15:37 0:00 /usr/lib/courier-imap/couriertcpd -address=0 -stderrlogger=/usr/sbin/courierlogger -stderrlo
root 6189 0.0 0.0 6940 880 ? S 15:37 0:00 /usr/sbin/courierlogger pop3d-ssl
root 6215 0.0 0.0 8756 952 ? Ss 15:37 0:00 /usr/sbin/xinetd
named 6264 0.0 0.2 48208 4192 ? Ssl 15:37 0:00 /usr/sbin/named -t /var/lib/named -u named
root 6345 0.0 0.0 7876 1392 ? S 15:37 0:00 /bin/sh /usr/bin/mysqld_safe --user=mysql --pid-file=/var/lib/mysql/mysqld.pid --socket=/var
mysql 6379 107 1.9 153580 40084 ? Sl 15:37 132:39 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/my
root 6460 0.0 0.5 111520 11944 ? Ss 15:37 0:04 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
root 6565 0.0 0.2 82968 6016 ? Ss 15:37 0:00 /usr/local/psa/admin/bin/httpsd
psaadm 6599 0.0 1.1 89668 24328 ? S 15:37 0:00 /usr/local/psa/admin/bin/httpsd
psaadm 6600 0.0 1.4 90248 28704 ? S 15:37 0:00 /usr/local/psa/admin/bin/httpsd
psaadm 6601 0.0 1.2 89668 26508 ? S 15:37 0:00 /usr/local/psa/admin/bin/httpsd
psaadm 6615 0.0 1.5 91128 31440 ? S 15:37 0:00 /usr/local/psa/admin/bin/httpsd
psaadm 6616 0.0 2.0 97228 42156 ? S 15:37 0:02 /usr/local/psa/admin/bin/httpsd
root 6726 0.0 0.0 2992 676 tty1 Ss+ 15:38 0:00 /sbin/mingetty --noclear tty1
root 6727 0.0 0.0 2992 676 tty2 Ss+ 15:38 0:00 /sbin/mingetty tty2
root 6728 0.0 0.0 2992 676 tty3 Ss+ 15:38 0:00 /sbin/mingetty tty3
root 6729 0.0 0.0 2992 676 tty4 Ss+ 15:38 0:00 /sbin/mingetty tty4
root 6730 0.0 0.0 2992 676 tty5 Ss+ 15:38 0:00 /sbin/mingetty tty5
root 6731 0.0 0.0 2992 676 tty6 Ss+ 15:38 0:00 /sbin/mingetty tty6
psaadm 6868 0.0 1.5 92904 32400 ? S 15:40 0:00 /usr/local/psa/admin/bin/httpsd
psaadm 6887 0.0 1.2 88400 25440 ? S 15:40 0:00 /usr/local/psa/admin/bin/httpsd
psaadm 6976 0.0 1.4 89356 29824 ? S 15:41 0:00 /usr/local/psa/admin/bin/httpsd
root 11430 0.0 0.5 111520 11932 ? S 16:24 0:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 16677 1.4 0.9 117796 19092 ? S 17:22 0:16 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 16829 1.5 0.9 117492 18788 ? S 17:23 0:15 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17024 0.5 0.9 117104 18540 ? S 17:26 0:04 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17051 1.6 0.9 117576 19064 ? S 17:26 0:14 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17194 0.1 0.9 117292 18644 ? S 17:27 0:01 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17201 1.2 0.9 118084 19388 ? S 17:27 0:09 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17256 0.3 0.9 117340 18636 ? S 17:28 0:02 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17455 0.7 0.9 117724 19172 ? S 17:30 0:04 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17463 0.4 0.9 117764 19248 ? S 17:30 0:02 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17487 0.4 0.9 117640 19092 ? S 17:30 0:03 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17541 0.5 0.9 117896 19108 ? R 17:30 0:03 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17548 0.5 0.9 117960 19256 ? S 17:30 0:03 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17607 0.5 1.0 119176 20664 ? S 17:31 0:03 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17625 1.0 0.9 117180 18632 ? S 17:31 0:05 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17626 0.4 0.9 117648 19100 ? S 17:31 0:02 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17747 0.4 0.9 117624 19104 ? S 17:32 0:01 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17829 0.0 0.9 117556 18836 ? S 17:33 0:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17833 0.3 0.9 117672 19116 ? S 17:33 0:01 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17906 1.1 0.9 117724 19020 ? S 17:34 0:03 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 17913 1.3 0.9 117388 18684 ? S 17:34 0:04 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 18053 0.4 0.9 117328 18764 ? S 17:36 0:01 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 18054 1.6 0.6 111724 12688 ? S 17:36 0:03 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 18070 0.6 0.9 117716 19008 ? S 17:36 0:01 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 18095 1.3 0.9 117392 18904 ? S 17:36 0:03 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 18110 0.4 0.9 117264 18584 ? S 17:36 0:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 18118 1.1 0.9 117336 18792 ? S 17:36 0:02 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 18218 0.4 0.9 117212 18520 ? S 17:37 0:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 18239 1.1 0.9 117068 18544 ? S 17:37 0:01 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 18241 1.1 0.9 117296 18820 ? S 17:38 0:01 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
root 18321 0.0 0.1 45108 2988 ? Ss 17:39 0:00 sshd: root@notty
root 18324 0.0 0.0 23448 1600 ? Ss 17:39 0:00 /usr/lib64/ssh/sftp-server
root 18352 0.0 0.1 45360 3020 ? Ss 17:39 0:00 sshd: root@pts/0
root 18355 0.0 0.1 8744 2156 pts/0 Ss 17:39 0:00 -bash
wwwrun 18393 0.0 0.5 111520 12048 ? S 17:40 0:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 18394 1.4 0.8 117052 18360 ? S 17:40 0:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 18395 1.7 0.8 117096 18380 ? S 17:40 0:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 18401 0.0 0.5 111520 12044 ? S 17:40 0:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
wwwrun 18405 1.4 0.9 117480 18756 ? S 17:40 0:00 /usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
root 18421 0.0 0.0 3820 896 pts/0 R+ 17:40 0:00 ps -aux

sirmoloch
21.09.06, 17:54
Ist der Query-Cache von MySQL groß genug?
Der gesamte Prozess nutzt nur 37 Mb fest. Ein wenig mehr kann wohl nicht schaden, vorallem, da du noch ausreichend Speicher frei hast.

PierreS
21.09.06, 18:51
Richtig, schau mal in der mysql-doku nach "optimze" etc. Bei der Größe fährst Du mit den Standard-Einstellungen nicht gut. 8000 Besucher/Tag hört sich gar nicht mal so extrem an. Welche Scripte setzt Du denn ein?

TheLastOne
21.09.06, 19:13
es Ist eine Neuentwicklung

PierreS
21.09.06, 19:33
Du entwickelst also selbst? Dann solltest Du mal DB-Schema und Deine Abfragen optimieren.

TheLastOne
21.09.06, 19:40
Nein ich entwickle nicht selbst, sorry wenn dies so rüber kam, also seit Ihr der Meinung das es am Script liegt

marce
21.09.06, 20:21
vermutlich eher am Query-Cache, aber möglich ist alles...