Mysql optimieren

kuesten

New Member
Hallo erstmal

Erster Beitrag hier und gleich eine Bitte / Frage

Ich habe einen dezidierter Server AMD Athlon 64 X2 Dual Core 3400 mit 8GB Ram
und mein Mysql braucht mir viel zu viel
Vorweg habe noch nichts optimiert. Habe mit aber das Tuning Primer Script installiert
hier mal meine my.cnf und das Ergebnis vom Tuning Primer

Code:
#
# 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]
#
# * 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
#
# 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
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover		= BACKUP
#max_connections        = 100
#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.
#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/

Code:
ySQL Version 5.0.51a-24+lenny5 i486

Uptime = 180 days 3 hrs 28 min 48 sec
Avg. qps = 33
Total Questions = 520389401
Threads Connected = 2

Server has been running for over 48hrs.
It should be safe to follow these recommendations

To find out more information on how each of these
runtime variables effects performance visit:
http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html
Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL's Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is NOT enabled.
Current long_query_time = 10 sec.
You have 64529 out of 520389422 that take longer than 10 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 6
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 100
Current threads_connected = 1
Historic max_used_connections = 101
The number of used connections is 101% of the configured maximum.
You should raise max_connections

INNODB STATUS
Current InnoDB index space = 438 M
Current InnoDB data space = 1.19 G
Current InnoDB buffer pool free = 0 %
Current innodb_buffer_pool_size = 8 M
Depending on how much space your innodb indexes take up it may be safe
to increase this value to up to 2 / 3 of total system memory

MEMORY USAGE
Max Memory Ever Allocated : 307 M
Configured Max Per-thread Buffers : 262 M
Configured Max Global Buffers : 42 M
Configured Max Memory Limit : 304 M
Physical Memory : 3.40 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 399 M
Current key_buffer_size = 16 M
Key cache miss rate is 1 : 183
Key buffer free ratio = 82 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 16 M
Current query_cache_used = 13 M
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = 81.62 %
Current query_cache_min_res_unit = 4 K
However, 34062752 queries have been removed from the query cache due to lack of memory
Perhaps you should raise query_cache_size
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
You have had 51066 queries where a join could not use an index properly
You have had 43 joins without keys that check for key usage after each row
You should enable "log-queries-not-using-indexes"
Then look for non indexed joins in the slow query log.
If you are unable to optimize your queries you may want to increase your
join_buffer_size to accommodate larger joins in one pass.

Note! This script will still suggest raising the join_buffer_size when
ANY joins not using indexes are found.

OPEN FILES LIMIT
Current open_files_limit = 1024 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_cache value = 64 tables
You have a total of 3274 tables
You have 64 open tables.
Current table_cache hit rate is 0%
, while 100% of your table cache is in use
You should probably increase your table_cache

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 32 M
Of 19582015 temp tables, 12% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 53 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 1370
You may benefit from selective use of InnoDB.
If you have long running SELECT's against MyISAM tables and perform
frequent updates consider setting 'low_priority_updates=1'
If you have a high concurrency of inserts on Dynamic row-length tables
consider setting 'concurrent_insert=2'.

Könnt ihr mir bitte ein wenig unter die Arme greifen und mir ein paar Tipps geben

vielen dank

lg Chris
 
Hallo und willkommen an Board!

Vorweg habe noch nichts optimiert.
Ich würde da mal anfangen. Denn das Tuning-Primer-Script gibt Dir eine ganze Menge Optimierungsmöglichkeiten die alle sofort greifen.

Nur eine weitere Einstellung, die das Script nicht angemeckert hat:
Die long_query_time würde ich auf 2 senken. Denn für mich ist jeder Query der länger als 2 Sekunden läuft schon zu lang.

@marce: Unnötiger Kommentar (zu diesem Zeitpunkt).
Denn man sieht doch in der Ausgabe dass fast alle Buffer ausgelastet sind.

huschi.
 
finde ich nicht - denn je nach dem, wie der Satz weiter geht...

braucht sein MySQL
- zu viel Zeit für Abfragen?
- zu viel Resourcen auf dem System?
- ...

... geht es auch weiter mit der Optimierung.

Und was sonst auf dem System so läuft ist durchaus relevant...
 
- zu viel Zeit für Abfragen?
- zu viel Resourcen auf dem System?
Steht Beides in der Ausgabe vom tuning-primer:
Zu viel Zeit (sagt er auch selber) und Resourcen sind ausreichend vorhanden, werden aber von MySQL nicht (mit-)genutzt.

Und was sonst auf dem System so läuft ist durchaus relevant...
Nicht wirklich, denn bei 3274 Tabellen wird es ein vollständiger Mischmasch von verschiedenen CMS-Systemen sein.

huschi.
 
frech gesagt: was tuning-primer sagt ist schön und gut - aber mir wäre erst mal wichtiger zu wissen, was der TE denn der Meinung ist, was sein MySQL zu viel braucht...

Und doch - es ist relevant. Oder gehen wir automatisch davon aus, daß das ein gemischter Server ist und alle möglichen Dienste drauf laufen oder können wir die Möhre 100% auf MySQL optimieren?
 
Nur so am Rande: 90% aller Anfragenden haben einen Server nur zum Hobby, bzw. um Freundes und/oder Firmen-Seiten zu hosten. Darauf sind dann eine ISP-Software, Webserver, MySql und Email.
Und die Erfahrung zeigt: von den 10% die es anders haben, beschreiben dies 9,5% auch sofort im ersten Beitrag.

@kuesten:
Was ich vorhin übersehen habe: Du hast 8GB RAM, aber bist auf 3,6 GB beschränkt, da Du ein 32-Bit-System fährst. Installiere mal einen PAE-Kernel.

huschi.
 
Back
Top