Keine Optimierungsmöglichkeiten mehr

cgde

New Member
Hi zusammen.
Ich habe ein komisches Problem.
Seit der aktualisierung meines Servers Debain 32 auf 64 Bit.
Habe ich enorm merkwürdige Parameter laut tuning primer und mysqltuner zu tätigen.
Vorweg: Alle meine neuen Scripte laufen nun mit PDO. Einige Tabellen habe ich auf INNODB umgestellt.
Ich habe keine langsamen Queries. Dafür aber ein dutzend Joins ohne index.
Laut log sinds immer die selben..Das beschränkt sich so auf 10-15 Queries.
Das war vorher aber auch schon so. Aufgrund dessen das ich einen Chat betreibe sind die entsprechenden Joins teilweise auch nur ohne indexe durchzuführen.
Ich versuche mich jetzt schon seit knapp 3 Wochen an einer brauchbaren Konfiguration. Jedenfalls komme ich leider auf kein brauchbares Ergebnis.
Egal wie ich hin und hereditiere.

Mein größtes Problem aktuell ist das mysqltuner sagt ich soll tmp_table_size herauf setzen. Allerdings habe ich auch hier schon 22G zugewiesen.
Das ist übertrieben, ich weiß, aber ich hatte es testhalber mal ausprobiert.
Er will jedenfalls immernoch mehr *g

Ich verzweifel langsam...
Das System läuft jetzt 1 Tag und ~30 Minuten.
Aber auch nach 3 tagen sieht es so aus..nur schlimmer :D

Mein System: Debian Wheezy - Plesk 64 bit - 32GB - MySQL.Ver: 5.5.41-0+wheezy

#######################################################

+---- my.cnf

Code:
# * Fine Tuning

key_buffer		= 16M
key_buffer_size	= 64M
max_allowed_packet	= 16M
thread_stack		= 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = FORCE,BACKUP
max_connections        = 80
max_user_connections	  = 80


table_cache            = 256M

tmp_table_size         = 22G
max_heap_table_size    = 22G


sort_buffer_size       = 1M
table_open_cache = 5000
table_definition_cache = 1500

low_priority_updates = 1

join_buffer_size = 128K

concurrent_insert = 2

query_cache_min_res_unit = 2K

thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit	= 8M
query_cache_size     = 32M
query_cache_type	= 1



expire_logs_days	= 10
max_binlog_size         = 25M

# * InnoDB


log_slow_queries	= /var/log/mysql/mysql-slow.log
long_query_time = 2
log-queries-not-using-indexes

innodb_buffer_pool_size = 6G


[mysqldump]
quick
quote-names
max_allowed_packet	= 16M

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

[isamchk]
key_buffer		= 16M

#######################################################

+---- tuning primer

Code:
Avg. qps = 179
Total Questions = 15876927
Threads Connected = 1

SLOW QUERIES
The slow query log is enabled.
Current long_query_time = 2.000000 sec.
You have 14224 out of 15876961 that take longer than 2.000000 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.5/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 = 80
Current threads_connected = 4
Historic max_used_connections = 12
The number of used connections is 15% of the configured maximum.
Your max_connections variable seems to be fine.

INNODB STATUS
Current InnoDB index space = 28 M
Current InnoDB data space = 153 M
Current InnoDB buffer pool free = 97 %
Current innodb_buffer_pool_size = 6.00 G
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 : 6.12 G
Configured Max Per-thread Buffers : 135 M
Configured Max Global Buffers : 6.10 G
Configured Max Memory Limit : 6.24 G
Physical Memory : 31.42 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 24 M
Current key_buffer_size = 64 M
Key cache miss rate is 1 : 16835
Key buffer free ratio = 72 %
Your key_buffer_size seems to be too high.
Perhaps you can use these resources elsewhere

QUERY CACHE
Query cache is enabled
Current query_cache_size = 32 M
Current query_cache_used = 9 M
Current query_cache_limit = 8 M
Current Query cache Memory fill ratio = 30.44 %
Current query_cache_min_res_unit = 2 K
MySQL won't cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 1 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 960 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 = 10090 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_open_cache = 5000 tables
Current table_definition_cache = 1500 tables
You have a total of 496 tables
You have 534 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 22.00 G
Current tmp_table_size = 22.00 G
Of 538456 temp tables, 37% were created on disk
Perhaps you should increase your tmp_table_size and/or max_heap_table_size
to reduce the number of disk-based temporary tables
Note! BLOB and TEXT columns are not allow in memory tables.
If you are using these columns raising these values might not impact your
ratio of on disk temp tables.

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

TABLE LOCKING
Current Lock Wait ratio = 1 : 486
You may benefit from selective use of InnoDB.


#######################################################

+--- mysqltuner

Code:
[OK] Currently running supported MySQL version 5.5.41-0+wheezy1-log
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MyISAM tables: 51M (Tables: 107)
[--] Data in InnoDB tables: 153M (Tables: 348)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[!!] Total fragmented tables: 352

-------- Security Recommendations  -------------------------------------------
[OK] All database users have passwords assigned

-------- Performance Metrics -------------------------------------------------
[--] Up for: 1d 0h 35m 4s (15M q [179.783 qps], 2M conn, TX: 12B, RX: 1B)
[--] Reads / Writes: 78% / 22%
[--] Total buffers: 28.1G global + 1.7M per thread (80 max threads)
[!!] Maximum possible memory usage: 28.2G (89% of installed RAM)
[OK] Slow queries: 0% (14K/15M)
[OK] Highest usage of available connections: 15% (12/80)
[OK] Key buffer size / total MyISAM indexes: 64.0M/24.4M
[OK] Key buffer hit rate: 100.0% (214M cached / 12K reads)
[OK] Query cache efficiency: 86.0% (11M cached / 12M selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (4 temp sorts / 553K sorts)
[!!] Joins performed without indexes: 963
[!!] Temporary tables created on disk: 59% (318K on disk / 539K total)
[OK] Thread cache hit rate: 99% (44 created / 2M connections)
[!!] Table cache hit rate: 1% (534 open / 34K opened)
[OK] Open file limit used: 2% (286/10K)
[OK] Table locks acquired immediately: 99% (2M immediate / 2M locks)
[OK] InnoDB buffer pool / data size: 6.0G/153.6M
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    Reduce your overall MySQL memory footprint for system stability
    Adjust your join queries to always utilize indexes
    Temporary table size is already large - reduce result set size
    Reduce your SELECT DISTINCT queries without LIMIT clauses
    Increase table_open_cache gradually to avoid file descriptor limits
    Read this before increasing table_open_cache over 64: http://bit.ly/1mi7c4C
Variables to adjust:
    join_buffer_size (> 128.0K, or always use indexes with joins)
    table_open_cache (> 5000)
 
dann lass den tmp.table.cache doch so - wenn Du das Datenmodell nicht so abändern kannst, daß es eben nicht mit Indices geht wird sich da nichts dran ändern.

Steht auch so in der Ausgabe.
 
ach so, ja klar - daß er sie nicht auf 22G lassen will hatte ich irgendwie stillschweigend vorrausgesetzt, da es ja nur zum Test war.
 
Ich habe die beiden Werte
tmp_table_size = 128MB
max_heap_table_size = 128MB

so nun erst einmal angepasst.

Wie sieht es aus mit open tables?
Der will dort auch immer mehr wie 5000?!

Wie kann ich sonst noch meine Konfiguration optimieren
und generell, warum schreibt er das er mehr tmp_table_size will?

Vorher war das auch nicht so *hmm
 
und generell, warum schreibt er das er mehr tmp_table_size will?
Weil eine Zahl von X darauf hindeutet, daß da was nicht stimmen könnte. Aber:
Note! BLOB and TEXT columns are not allow in memory tables.
If you are using these columns raising these values might not impact your
ratio of on disk temp tables.
Mehr dazu findest Du in der MySQL-Doku. Es gibt auch (irgendeine, recht komplizierte) Methode, die "zwingend-temp-File" temp-tables separat herauszurechenen, dann weißt Du anhand der restlichen, ob es da noch was zu tun gibt. Mal sehen, vielleicht finde ich den Link morgen noch irgendwo...

... und der Rest sieht gut aus - wenn Du also keine Performanceprobleme hast, dann passt das aoch auch.
 
Last edited by a moderator:
okay...

Wie sieht es aus?
Für die Texte im Chat nutz ich für die spalte message den Typ Text.
Gibts da evtl. bessere alternativen als Text?
 
Oldschool, aber oft passend, ausreichend und immer noch trivial - varchar.

Ob's zur Applikation passt - weiß der Entwickler.
 
nun ja.. varchar ist doch mit ner 300 length ausgelegt oder?
Oder geht der Typ auch auf 500 zu setzen? Dann wärs doch optimal.
Ich brauch dann nur noch für den Textinput der User auf 500 zu limitieren.
 
*lach, die hab ich gerade gelesen.
Seh ich das richtig das varchar mit 65,535 ausgelegt werden kann?
Dann hat sich das Problem doch erledigt oder?
 
Back
Top