Gerd H.: MySQL 4.1 -> MySQL 5.0 Performance Problem

Beitrag lesen

Hallo Forum,

ich habe aufgrund steigender Besucherzahlen einen Serverumzug durchgeführt. Dabei habe ich gliehczeitig einen Softwareupgrade vollzogen.

Neues System:
AMD Opteron 1218 Dual Core mit 4 GB RAM sollte für meine Seite mit 150.000 Views und 3000 Besuchern pro Tag vollkommen ausreichen.

Kurzzusammenfassung
-------------------
Vorher:
Debian Sarge
Apache2
PHP4
MySQL4.1

Nachher:
Debian ETch
Apache2.2
PHP5
MySQL5.0
-------------------

Ansonsten laufen auf dem System: Mailserver, FTP-Server

Vorher war es der Apache der mir sorgen bereitete und die CPU voll auslastete. Nach dem Serverumzug ist es der MySQL-server anscheinend:

  
 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND  
11819 mysql     15   0 1177m 221m 5952 S  126  5.7  37:42.65 mysqld  
12029 root      15   0 11128 1752  948 R    2  0.0   0:00.16 top  
10945 www-data  15   0  108m  10m 5596 S    1  0.3   0:01.03 apache2  
11125 www-data  16   0  108m  11m 5828 S    1  0.3   0:00.69 apache2  
11147 www-data  15   0  108m 9844 4200 S    1  0.2   0:00.58 apache2  
11164 www-data  17   0  108m  10m 5052 S    1  0.3   0:00.52 apache2  
11167 www-data  15   0  108m  10m 5344 S    1  0.3   0:00.76 apache2  
11700 www-data  15   0  108m  10m 5244 S    1  0.3   0:00.40 apache2  
11703 www-data  15   0  108m  10m 5072 S    1  0.3   0:00.52 apache2  
10427 www-data  15   0  108m  11m 5900 S    0  0.3   0:01.18 apache2  
10434 www-data  15   0  108m  10m 5520 S    0  0.3   0:01.07 apache2  
10567 www-data  15   0  108m  11m 5716 S    0  0.3   0:00.95 apache2  
10981 www-data  15   0  108m  10m 5500 S    0  0.3   0:00.71 apache2  
11103 www-data  15   0  108m  10m 5076 S    0  0.3   0:00.56 apache2  
11115 www-data  15   0  108m  10m 5028 S    0  0.3   0:00.57 apache2  
11141 www-data  15   0  108m  10m 5392 S    0  0.3   0:00.62 apache2  
11179 www-data  15   0  108m  10m 5300 S    0  0.3   0:00.87 apache2  
11181 www-data  15   0  108m  10m 4676 S    0  0.3   0:00.41 apache2  
11213 www-data  15   0  108m  10m 5560 S    0  0.3   0:00.92 apache2  
11629 www-data  15   0  108m  10m 5060 S    0  0.3   0:00.22 apache2  
11671 www-data  15   0  108m  10m 5044 S    0  0.3   0:00.45 apache2  
11884 www-data  15   0  108m  10m 5136 S    0  0.3   0:00.46 apache2  
11931 www-data  15   0  108m 9844 4232 S    0  0.2   0:00.21 apache2  
    1 root      15   0  6120  688  564 S    0  0.0   0:01.38 init  
    2 root      RT   0     0    0    0 S    0  0.0   0:00.24 migration/0  

Meine my.cnf:

  
Opteron1:~# cat /etc/mysql/my.cnf  
# The following options will be passed to all MySQL clients  
[client]  
#password       = your_password  
port            = 3306  
socket          = /var/run/mysqld/mysqld.sock  
character_set         = utf8  
default-character-set = utf8  
  
# The MySQL server  
[mysqld]  
character-set-server  = utf8  
default-character-set = utf8  
init-connect='SET NAMES utf8'  
port            = 3306  
socket          = /var/run/mysqld/mysqld.sock  
skip-locking  
# key_buffer_size sollte ca. 25% des gesamten RAMs ausmachen  
key_buffer = 1024M  
# key_cache_block_size = 1024  
max_allowed_packet = 1M  
table_cache = 1000  
# table_cache = 512  
sort_buffer_size = 2M  
read_buffer_size = 2M  
read_rnd_buffer_size = 8M  
myisam_sort_buffer_size = 64M  
# thread_cache_size = 8  
thread_cache_size = 101  
  
# Query Cache  
query_cache_type=1  
query_cache_size = 32M  
query_cache_limit = 1M  
  
# Try number of CPU's*2 for thread_concurrency  
# thread_concurrency = 4  
thread_concurrency = 8  
  
# Testzweck nach tuning.sh  
concurrent_insert=2  
low_priority_updates=1  
  
# * 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  
log-error     = /var/log/mysql.err  
  
#  
# 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  
  
[mysqldump]  
quick  
max_allowed_packet = 16M  
  
[mysql]  
no-auto-rehash  
# Remove the next comment character if you are not familiar with SQL  
safe-updates  
  
#[isamchk]  
#key_buffer = 1024M  
#sort_buffer_size = 256M  
#read_buffer = 2M  
#write_buffer = 2M  
  
#[myisamchk]  
#key_buffer = 1024M  
#sort_buffer_size = 256M  
#read_buffer = 2M  
#write_buffer = 2M  
  
[isamchk]  
key_buffer=128M  
sort_buffer_size=128M  
read_buffer=2M  
write_buffer=2M  
  
[myisamchk]  
key_buffer=128M  
sort_buffer_size=128M  
read_buffer=2M  
write_buffer=2M  
  
[mysqlhotcopy]  
interactive-timeout