Tagesaufgabe: MYSQL Optimieren

Skorpy

New Member
Code:
        -- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -

MySQL Version 5.0.32-Debian_7etch12-log x86_64

/usr/bin/tuning-primer.sh: line 497: bc: command not found
/usr/bin/tuning-primer.sh: line 498: bc: command not found
/usr/bin/tuning-primer.sh: line 499: bc: command not found
/usr/bin/tuning-primer.sh: line 500: bc: command not found
/usr/bin/tuning-primer.sh: line 501: bc: command not found
/usr/bin/tuning-primer.sh: line 502: bc: command not found
Uptime =  days  hrs  min  sec
Avg. qps = 1
Total Questions = 45564
Threads Connected = 1

Warning: Server has not been running for at least 48hrs.
It may not be safe to use 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 0 out of 45585 that take longer than 10 sec. to complete
/usr/bin/tuning-primer.sh: line 403: bc: command not found
/usr/bin/tuning-primer.sh: line 606: [: -gt: unary operator expected
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is enabled
Binlog sync is not enabled, you could loose binlog records during a server crash

WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 5
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 = 6
The number of used connections is 6% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See "MEMORY USAGE" section to make sure you are not over-allocating

No InnoDB Support Enabled!

MEMORY USAGE
/usr/bin/tuning-primer.sh: line 1321: bc: command not found
/usr/bin/tuning-primer.sh: line 1322: bc: command not found
/usr/bin/tuning-primer.sh: line 1346: bc: command not found
/usr/bin/tuning-primer.sh: line 1349: bc: command not found
/usr/bin/tuning-primer.sh: line 1350: bc: command not found
/usr/bin/tuning-primer.sh: line 1352: bc: command not found
/usr/bin/tuning-primer.sh: line 1354: [: -gt: unary operator expected
/usr/bin/tuning-primer.sh: line 459: [: max_memoryHR: integer expression expected
/usr/bin/tuning-primer.sh: line 465: [: max_memoryHR: integer expression expected
/usr/bin/tuning-primer.sh: line 471: [: max_memoryHR: integer expression expected
/usr/bin/tuning-primer.sh: line 478: export: `=max_memoryHR': not a valid identifier
Max Memory Ever Allocated :  bytes
/usr/bin/tuning-primer.sh: line 459: [: per_thread_buffersHR: integer expression expected
/usr/bin/tuning-primer.sh: line 465: [: per_thread_buffersHR: integer expression expected
/usr/bin/tuning-primer.sh: line 471: [: per_thread_buffersHR: integer expression expected
/usr/bin/tuning-primer.sh: line 478: export: `=per_thread_buffersHR': not a valid identifier
Configured Max Per-thread Buffers :  bytes
/usr/bin/tuning-primer.sh: line 459: [: global_buffersHR: integer expression expected
/usr/bin/tuning-primer.sh: line 465: [: global_buffersHR: integer expression expected
/usr/bin/tuning-primer.sh: line 471: [: global_buffersHR: integer expression expected
/usr/bin/tuning-primer.sh: line 478: export: `=global_buffersHR': not a valid identifier
Configured Max Global Buffers :  bytes
/usr/bin/tuning-primer.sh: line 459: [: total_memoryHR: integer expression expected
/usr/bin/tuning-primer.sh: line 465: [: total_memoryHR: integer expression expected
/usr/bin/tuning-primer.sh: line 471: [: total_memoryHR: integer expression expected
/usr/bin/tuning-primer.sh: line 478: export: `=total_memoryHR': not a valid identifier
Configured Max Memory Limit :  bytes
/usr/bin/tuning-primer.sh: line 440: bc: command not found
Physical Memory :  G
Max memory limit seem to be within acceptable norms

KEY BUFFER
/usr/bin/tuning-primer.sh: line 754: bc: command not found
/usr/bin/tuning-primer.sh: line 755: bc: command not found
/usr/bin/tuning-primer.sh: line 440: bc: command not found
Current MyISAM index space =  M
/usr/bin/tuning-primer.sh: line 440: bc: command not found
Current key_buffer_size =  M
Key cache miss rate is 1 : 53
Key buffer free ratio =  %
/usr/bin/tuning-primer.sh: line 788: [: -le: unary operator expected
/usr/bin/tuning-primer.sh: line 792: [: -le: unary operator expected
/usr/bin/tuning-primer.sh: line 796: [: -le: unary operator expected
Your key_buffer_size seems to be fine

QUERY CACHE
/usr/bin/tuning-primer.sh: line 827: bc: command not found
/usr/bin/tuning-primer.sh: line 828: bc: command not found
Query cache is enabled
/usr/bin/tuning-primer.sh: line 440: bc: command not found
Current query_cache_size =  M
/usr/bin/tuning-primer.sh: line 440: bc: command not found
Current query_cache_used =  M
/usr/bin/tuning-primer.sh: line 440: bc: command not found
Current query_cache_limit =  K
Current Query cache Memory fill ratio =  %
/usr/bin/tuning-primer.sh: line 440: bc: command not found
Current query_cache_min_res_unit =  K
/usr/bin/tuning-primer.sh: line 845: bc: command not found
/usr/bin/tuning-primer.sh: line 846: bc: command not found
/usr/bin/tuning-primer.sh: line 847: [: -gt: unary operator expected
/usr/bin/tuning-primer.sh: line 854: [: -le: unary operator expected
/usr/bin/tuning-primer.sh: line 858: [: -ge: unary operator expected
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
/usr/bin/tuning-primer.sh: line 440: bc: command not found
Current sort_buffer_size =  M
/usr/bin/tuning-primer.sh: line 440: bc: command not found
Current read_rnd_buffer_size =  K
Sort buffer seems to be fine

JOINS
/usr/bin/tuning-primer.sh: line 440: bc: command not found
Current join_buffer_size =  K
You have had 5 queries where a join could not use an index properly
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 386 tables
You have 64 open tables.
Current table_cache hit rate is 2%
, while 100% of your table cache is in use
You should probably increase your table_cache

TEMP TABLES
/usr/bin/tuning-primer.sh: line 440: bc: command not found
Current max_heap_table_size =  M
/usr/bin/tuning-primer.sh: line 440: bc: command not found
Current tmp_table_size =  M
Of 2825 temp tables, 17% 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
/usr/bin/tuning-primer.sh: line 440: bc: command not found
Current read_buffer_size =  K
Current table scan ratio = 41 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 3288
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'.

Wie soll ich weiter vorgehen?
 
Wie wärs denn zu Anfang mit der Installation von bc, damit nicht mehr so viele Fehlermeldungen kommen...
 
Wie wärs denn zu Anfang mit der Installation von bc, damit nicht mehr so viele Fehlermeldungen kommen...

Hey Sorry, wenn ich viele Fragen stellen, aber da ich mir das heute vorgenommen habe versuch ich das beste jetzt drauß. Kannst du mir sagen wie ich diesen "bc" installiere? Eventuell nen Befehlparat. Hab mal die SuFu benutzt und nach "bc installieren" gesucht aber nichts gefunden was auch nur annähernd richtig sein könnte.
 
Code:
-- MYSQL PERFORMANCE TUNING PRIMER --
             - By: Matthew Montgomery -

MySQL Version 5.0.32-Debian_7etch12-log x86_64

Uptime = 0 days 0 hrs 32 min 25 sec
Avg. qps = 7
Total Questions = 14225
Threads Connected = 1

Warning: Server has not been running for at least 48hrs.
It may not be safe to use 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 0 out of 14246 that take longer than 10 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is enabled
Binlog sync is not enabled, you could loose binlog records during a server crash

WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 3
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 = 4
The number of used connections is 4% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See "MEMORY USAGE" section to make sure you are not over-allocating

No InnoDB Support Enabled!

MEMORY USAGE
Max Memory Ever Allocated : 26 M
Configured Max Per-thread Buffers : 265 M
Configured Max Global Buffers : 16 M
Configured Max Memory Limit : 281 M
Physical Memory : 2.00 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 2 M
Current key_buffer_size = 2 M
Key cache miss rate is 1 : 35
Key buffer free ratio = 61 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 4 M
Current query_cache_used = 3 M
Current query_cache_limit = 512 K
Current Query cache Memory fill ratio = 90.30 %
Current query_cache_min_res_unit = 4 K
However, 471 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 0 queries where a join could not use an index properly
Your joins seem to be using indexes properly

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 386 tables
You have 64 open tables.
Current table_cache hit rate is 4%
, 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 645 temp tables, 7% 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 = 29 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 2797
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'.

Mit weniger Fehlermeldungen. Habe über apt-get install bc den bc installiert. Danach einfach tuning-primer.sh als root eingegeben und das oben rausbekommen, jetzt muss ich irgendwas ändern. Bloß was?
 
However, 471 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

Er schreibt doch zu allem was du tun sollst.
 
Ja aber wo und wie? Versteh nicht was damit gemeint ist

RTFM...: http://www.google.de/search?q=query_cache_size

query_cache_size ist ein MySQL Konfigurationsparameter, den Du in MySQL anpassen musst.

PS: Ein bißchen Eigeninitiative sollte man von einem alleinverantwortlichen "Root"serverbetreiber schon erwarten können. MySQL zu "verstehen" und zu optimieren ist übrigens sicher nicht als "Tagesaufgabe" zu betrachten, wenn man noch nie damit gearbeitet hat.
 
@Skorpy: Da sich die Anforderungen an deine mySQL-Instanz praktisch täglich ändern können, solltest du die Einstellungen regelmässig kontrollieren. Viel Last => mehr Speicher. Wenig Last => weniger Speicher. Andere Arten von Abfragen => andere Optimierungsanforderungen etc.

Mit einmal Einstellen ist es nicht getan.
 
@Skorpy: Da sich die Anforderungen an deine mySQL-Instanz praktisch täglich ändern können, solltest du die Einstellungen regelmässig kontrollieren. Viel Last => mehr Speicher. Wenig Last => weniger Speicher. Andere Arten von Abfragen => andere Optimierungsanforderungen etc.

Mit einmal Einstellen ist es nicht getan.

Echt? Hab ich nicht gewusst, hab gedacht 1x einstellen und fertig.
Eigeninitiative okay und gut. Ich denke, wenn mir das jemand mal vorführen würde, würde ich das für immer können (hört sich komisch an, ist aber so)

Ich hab bis jetzt immernoch keine Ahnung was ich tun soll. :(

Grüße,

Ich würde auch gerne Hilfestellungen über Messenger nehmen, falls jemand die Lust und Zeit hat.
 
Schau hier mal nach: http://dev.mysql.com/doc/refman/5.1/en/

Du solltest vorher aber die richtige Version auswählen. Da steht alles was du wissen musst. Wenn dir der Primer einen Parameter zum Anpassen vorschlägt, kannst du dort über die Suche danach suchen und du siehst was du einstellen kannst und wie.

Viel Erfolg.
 
Die Konfigurationsdatei /etc/my.cnf musst du entsprechend anpassen.

Hey Danke :)

Aber jetzt steh ich vor dem Problem, was da jetzt überhaupt angepasst werden soll.

Hier die my.cnf (ahja die my.cnf war bei mir in einem Unterordner namens mysql)

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

skip-bdb

[mysqld]
set-variable=local-infile=0
#
# * 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		= 127.0.0.1
#
# * Fine Tuning
#
key_buffer		= 2M
max_allowed_packet	= 4M
thread_stack		= 128K
thread_cache_size	= 8
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit       = 512K
query_cache_size        = 4M
#
# * 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.
#server-id		= 1
log_bin			= /var/log/mysql/mysql-bin.log
# WARNING: Using expire_logs_days without bin_log crashes the server! See README.Debian!
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	= 4M

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

[isamchk]
key_buffer		= 2M

#
# * 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!
#
!includedir /etc/mysql/conf.d/
 
Siehe Ben.

Was willst du denn noch mehr? Da stehen die genauen Parameter die nicht stimmen.
 
Siehe Ben.

Was willst du denn noch mehr? Da stehen die genauen Parameter die nicht stimmen.

Ich versteh nicht wie ich das eintragen soll, :( Kann mir das jemand mal zeigen. Wenn ich es doch verstehen würde, würd ich euch echt nicht belästigen hier und eure nerven stehlen. :(
 
Was macht der User nano und was soll ich vergleichen. :(
nano ist ein Texteditor um Konfigurationsfiles zu bearbeiten.

Und es tut mir ja leid, aber das ist doch ein Trauerspiel hier.

Du hast dir einen Server gekauft und bist offensichtlich nicht in der Lage ihn zu administrieren. Hole dir hier im Forum Angebote für einen fähigen Administrator, der dir den Server auf Vordermann bringt.
Mit deinem aktuellen Wissensstand kann dir hier keiner helfen. Wenn du das Ding selber hinbekommen willst, wirst du dir erstmal Grundkenntnisse in Sachen Linux aneignen müssen und vor allem lernen müssen dir Problemlösungen selbst zu erarbeiten.
 
Ja, kann mir niemand die Konfigurationsdatei mal ausschreiben, damit ich sehe was verändert wurde, dann checks ich ja. Ich hab mich mit Linux noch nie befasst - richtig. Aber versteht mich doch. Für euch "Fortgeschrittene" ist das hier wahrscheinlich die Belustigung des Tages (^^ kann ich echt verstehen :D) aber für mich ist das wichtig :/
 
Ja, kann mir niemand die Konfigurationsdatei mal ausschreiben, damit ich sehe was verändert wurde, dann checks ich ja. Ich hab mich mit Linux noch nie befasst - richtig. Aber versteht mich doch.
Ich werde es sicher nicht tun. Hier herrscht "Hilfe zur Selbsthilfe" (siehe Forenmotto) und nicht "such dir nen Dummen der dir alles vorkaut".
Dass du dich noch nie mit Linux befasst hast ist uns klar und genau das ist das Problem, siehe voriger Post von mir.
Versteh du doch uns, dass wir dir nicht alles vorkauen wollen. Wir helfen gerne, aber dazu müssen zumindest mal Grundkenntnisse vorhanden sein und das sind sie bei dir definitiv nicht. Setz dir daheim eine virtuelle Maschine mit VMWare oder einer anderen Virtualisierungslösung und probier damit rum, (ich würde ja sagen bevor du dir nen Server kaufst, aber das is ja schon wieder zu spät...) bevor du weitermachst.

Ich empfinde das übrigens keinesfalls als belustigend sondern eher als haaresträubend!
 
Back
Top