MYSQL arbeitet mit 107 %

frank.freeny

New Member
Hallo ich habe folgendes Problem das MYSQL unter Volllast arbeitet.

Kurze Eckdaten vom Server

4 x 2,10 Ghz
6 GB RAM

Debian Lenny mit Confixx


Das ist meine my.cnf

Code:
[mysqld_safe]
socket		= /var/run/mysqld/mysqld.sock
nice		= 0

[mysqld]
#
# * Basic Settings
#
user		= mysql
pid-file	= /var/run/mysqld/mysqld.pid
socket		= /var/run/mysqld/mysqld.sock
port		= 3306
basedir		= /usr
datadir		= /var/lib/mysql
tmpdir		= /tmp
language	= /usr/share/mysql/english
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		= 0.0.0.0
#
# * Fine Tuning
#
key_buffer		= 512M
max_allowed_packet	= 16M
thread_stack		= 512K
thread_cache_size	= 256K
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover		= BACKUP
max_connections        = 600
table_cache            = 12M
thread_concurrency     = 10
join_buffer_size = 1M
read_buffer_size = 1M
read_rnd_buffer_size = 512K
net_buffer_length = 256K
sort_buffer_size = 20M
low_priority_updates = 1
concurrent_insert = 2
myisam_sort_buffer_size = 20M
#
# * Query Cache Configuration
#
query_cache_limit       = 6M
query_cache_size        = 16M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
log		= /var/log/mysql/mysql.log
#
# Error logging goes to syslog. This is a Debian improvement :)
#
# 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
#
# * BerkeleyDB
#
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
skip-bdb
#
# * 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!
# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
#skip-innodb
#
# * 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	= 32M

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

[isamchk]
key_buffer		= 32M

#
# * NDB Cluster
#
# See /usr/share/doc/mysql-server-*/README.Debian for more information.
#
# The following configuration is read by the NDB Data Nodes (ndbd processes)
# not from the NDB Management Nodes (ndb_mgmd processes).
#
# [MYSQL_CLUSTER]
# ndb-connectstring=127.0.0.1


#
# * 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/

Wenn ich mich per root in phpMyAdmin einloge sind folgende Werte rot

Code:
Innodb_buffer_pool_reads  	452 k
Handler_read_rnd  	59 M
Handler_read_rnd_next  	568 G
Qcache_lowmem_prunes  	5,248 k
Created_tmp_disk_tables  	122 k
Select_full_join  	208 k
Select_range_check  	704
Sort_merge_passes  	2  	 
Opened_tables  	28 k
Table_locks_waited  	11 k

Hatt jemand gute Vorschläge

Es sind viele Scripte drauf und viele Kunden hier mal ein Auszug von top

Code:
top - 08:41:46 up 19 days, 22:27,  1 user,  load average: 1.33, 1.29, 1.33
Tasks: 284 total,   1 running, 283 sleeping,   0 stopped,   0 zombie
Cpu(s): 29.0%us,  3.4%sy,  0.0%ni, 67.6%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   5873244k total,  4912708k used,   960536k free,   269304k buffers
Swap:  1004020k total,     9804k used,   994216k free,  2845072k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
25510 mysql     20   0  990m 352m 6300 S  100  6.1  22:00.08 mysqld
 8352 www-data  20   0  363m 147m 5048 S    5  2.6   0:01.32 apache2
 7780 root      20   0 19088 1444  940 R    1  0.0   0:02.24 top
 8017 www-data  20   0  359m 143m 5016 S    1  2.5   0:02.18 apache2
 8280 www-data  20   0  358m 142m 4760 S    1  2.5   0:01.36 apache2
 8351 www-data  20   0  356m 142m 4204 S    1  2.5   0:01.22 apache2
 8533 www-data  20   0  340m 124m 4596 S    1  2.2   0:00.82 apache2
 8658 www-data  20   0  340m 124m 4668 S    1  2.2   0:00.78 apache2
 8735 www-data  20   0  342m 125m 4748 S    1  2.2   0:00.82 apache2
 8963 www-data  20   0  337m 123m 3876 S    1  2.2   0:00.16 apache2
    1 root      20   0 10312  688  576 S    0  0.0   0:08.30 init
    2 root      15  -5     0    0    0 S    0  0.0   0:00.00 kthreadd
    3 root      RT  -5     0    0    0 S    0  0.0   0:02.70 migration/0
    4 root      15  -5     0    0    0 S    0  0.0   0:01.82 ksoftirqd/0
 
RAM scheint nicht wirklich das Problem zu sein, MySQL hat ja mehr als genug reserviert, nutzt aber nur einen Bruchteil. Gut, kann sein dass er an falscher Stelle reserviert ist, da kann dir tuning-primer.sh helfen.

An der CPU-Last wird das aber nicht viel ändern, da könnte es allenfalls helfen den Query Cache zu vergrößern. Oder schau mal mit mytop ob es irgend ein bestimmter Query ist der so viel Last erzeugt.
 
Schau dir mal die laufenden Queries mit mtop oder den mySQL an. Vielleicht sind da ein paar Queries nicht ganz optimal.
 
Back
Top