PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Flaschenhals



kaptain Iglo
11.07.08, 22:52
Ich habe ein Problem mit Lamp.
Folgende Situation:
Ich habe typo3 am Laufen. Es gibt hier viele Seiten und viele Dokumente. Die
Suche ist richtig lahm. Bei Anfragen geht es gut 20-60 Sekunden bis die Suche durchgeführt ist.
Bisher habe ich die slow_queries eingeschalten und dadurch die sql abfrage zu Gesicht bekommen. Wenn ich das ganze über Phpadmin abfrage geht es genau so lang. Frage ich das ganze direkt auf der Konsole in der Mysql ab, geht es 2-3 Sekunden.
Jetzt zu meinem problem:
Wo könnte hier der Flaschenhals liegen? Wie bekomme ich das Problem raus?

bla!zilla
12.07.08, 09:24
Bitte mal mehr Details:

- Was für Hardware verwendest du?
- Wieviele RAM
- Wieviele RAM ist für MySQL gedacht?
- Was sagt mysqldumpslow -s c -t 10?
- Was gibt die EXPLAIN SELECT.... für die entsprechende Query aus?
- Lass bitte mal das tuning-primer.sh (http://www.day32.com/MySQL/tuning-primer.sh) Skript laufen.

kaptain Iglo
12.07.08, 13:52
Danke für die Antwort.
Maschine ist ein Dual_Xeon 1,8 mit 4gb ram.
Das tuning-primer habe ich schon drüberlaufen lassen.
Das ist soweit zufrieden.
Den Rest muss ich am Montag schauen.
Kann nur sagen das bei einer Suchabfrage der Mysql Prozess eine CPU Auslastung von 140% verursacht.

Ich schau am Montag gleich nach den restlichen Daten.

marce
13.07.08, 14:01
poste auch gleich mal die my.cnf mit...

kaptain Iglo
14.07.08, 10:02
Sodele,
jetzt habe ich ein paar Daten.
mysqldumpslow spuckt bei mir nur eine Fehlermeldung aus. (Can't determine basedir)

Das spuckt Explain aus:

id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE ISEC ref joinkey,rl0,rl0_2 rl0_2 4 const 193 Using index; Using temporary; Using filesort
1 SIMPLE IR ref PRIMARY,wid PRIMARY 4 intranet.ISEC.phash 185 Using index
1 SIMPLE IW eq_ref PRIMARY PRIMARY 4 intranet.IR.wid 1 Using where


Und das ist meine my.cnf:

[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]
#
# * 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
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 = 127.0.0.1
#
# * Fine Tuning
#
key_buffer = 16M
max_allowed_packet = 16M
thread_stack = 128K
thread_cache_size = 8
#max_connections = 100
table_cache = 250
#thread_concurrency = 10
#
# * Query Cache Configuration
#
query_cache_limit = 3M
query_cache_size = 64M
#
# * 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 = 16M

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

[isamchk]
key_buffer = 16M

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

marce
14.07.08, 10:07
Mit der my.cnf wirst Du nicht glücklich werden - erhöhe mal ordentlich die Caches.

Es gibt (je nach Distri) irgendwo im System (hier z.B. /usr/share/doc/mysql-server*) versteckt ein my-huge.cnf oder my-large.cnf - nimm die mal als Ausgangspunkt und passe Sie nach Deinen Anforderungen an.

kaptain Iglo
14.07.08, 16:50
Vielen Dank für die Info.

Habe ich gemacht und das ganze sieht schon ein wenig freundlicher aus.

Ich werde es am Mittwoch nochmal testen, wenn die ganzen Caches wieder
leer sind.

marce
14.07.08, 17:16
Ich werde es am Mittwoch nochmal testen, wenn die ganzen Caches wieder leer sind.
???

Caches sollen _nicht_ leer sein.

Ansonsten - es gibt z.B. bei phpMyAdmin auch eine nette Info/Status-Seite, wo einem die bösesten Werte hübsch-rot angezeigt werden - zur ersten Optimierung sollte das auch hilfreich sein...