2010-11-09 14 views
8

Sto utilizzando MySQLTuner.pl per ottimizzare il mio sito .... anche se non sono completamente sicuro su come risolvere alcuni di questi problemi e mi chiedo se qualcuno possa darmi una mano.Efficienza cache query

Io corro 16GB di RAM con le seguenti impostazioni di MySQL:

key_buffer    = 1024M 
max_allowed_packet  = 16M 
thread_stack   = 192K 
thread_cache_size  = 8 

myisam-recover   = BACKUP 
max_connections  = 1500 
table_cache   = 256 
thread_concurrency  = 4 

query_cache_limit  = 2M 
query_cache_size  = 32M 
query_cache_type  = 1 

tmp_table_size   = 512M 
max_heap_table_size  = 128M 
join_buffer_size  = 128M 
myisam_sort_buffer_size = 512M 

ecco l'output del mio sintonizzatore

-------- General Statistics -------------------------------------------------- 
[--] Skipped version check for MySQLTuner script 
[OK] Currently running supported MySQL version 5.1.41-3ubuntu12.6-log 
[OK] Operating on 64-bit architecture 

-------- Storage Engine Statistics ------------------------------------------- 
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
[--] Data in MyISAM tables: 98M (Tables: 402) 
[--] Data in InnoDB tables: 16K (Tables: 1) 
[!!] Total fragmented tables: 17 

-------- Performance Metrics ------------------------------------------------- 
[--] Up for: 10s (1K q [132.400 qps], 443 conn, TX: 119K, RX: 82K) 
[--] Reads/Writes: 100%/0% 
[--] Total buffers: 1.2G global + 130.6M per thread (1500 max threads) 
[!!] Maximum possible memory usage: 192.4G (1225% of installed RAM) 
[OK] Slow queries: 0% (0/1K) 
[OK] Highest usage of available connections: 0% (2/1500) 
[OK] Key buffer size/total MyISAM indexes: 1.0G/72.5M 
[!!] Key buffer hit rate: 72.3% (47 cached/13 reads) 
[!!] Query cache efficiency: 0.0% (0 cached/875 selects) 
[OK] Query cache prunes per day: 0 
[OK] Sorts requiring temporary tables: 0% (0 temp sorts/2 sorts) 
[OK] Temporary tables created on disk: 23% (48 on disk/201 total) 
[OK] Thread cache hit rate: 99% (2 created/443 connections) 
[!!] Table cache hit rate: 4% (128 open/2K opened) 
[OK] Open file limit used: 3% (257/7K) 
[OK] Table locks acquired immediately: 100% (449 immediate/449 locks) 
[OK] InnoDB data size/buffer pool: 16.0K/8.0M 

-------- Recommendations ----------------------------------------------------- 
General recommendations: 
    Run OPTIMIZE TABLE to defragment tables for better performance 
    MySQL started within last 24 hours - recommendations may be inaccurate 
    Reduce your overall MySQL memory footprint for system stability 
    Increase table_cache gradually to avoid file descriptor limits 
Variables to adjust: 
    *** MySQL's maximum memory usage is dangerously high *** 
    *** Add RAM before increasing MySQL buffer variables *** 
    query_cache_limit (> 2M, or use smaller result sets) 
    table_cache (> 128) 

Quando diminuisco query_cache_limit e table_cache non sembra avere qualsiasi effetto Ho riavviato MySQL nelle ultime 24 ore che potrebbero essere parte del problema.

aggiornamento

Dopo aver eseguito SHOW STATUS LIKE '%cache%' l'uscita è

Variable_name Value 
Binlog_cache_disk_use 0 
Binlog_cache_use 0 
Com_assign_to_keycache 0 
Qcache_free_blocks 436 
Qcache_free_memory 23551488 
Qcache_hits 72553 
Qcache_inserts 26954 
Qcache_lowmem_prunes 0 
Qcache_not_cached 7164 
Qcache_queries_in_cache 5877 
Qcache_total_blocks 12347 
Ssl_callback_cache_hits 0 
Ssl_session_cache_hits 0 
Ssl_session_cache_misses 0 
Ssl_session_cache_mode NONE 
Ssl_session_cache_overflows 0 
Ssl_session_cache_size 0 
Ssl_session_cache_timeouts 0 
Ssl_used_session_cache_entries 0 
Threads_cached 3 
+1

Per "effetto" si intende prestazioni migliori o meno avvisi da MySQLTuner? – AndreKR

+0

prestazioni migliori. Mi aspetto un enorme carico di server all'inizio di dicembre e occorrerà un po 'di prestazioni – Webnet

+1

L'avviso significa solo che il tuo server non ha abbastanza RAM (e quindi si scambierà) quando usa tutta la RAM che hai permesso di usare . Pertanto, la riduzione della dimensione della cache delle query potrebbe far sì che l'avviso scompaia ma non aumenterà direttamente le prestazioni. Ad ogni modo, sembra che la cache della tua query non sia affatto utilizzata, quindi dovresti controllare perché questo è il caso. (Tuttavia, la cache delle query è molto meno importante della cache dell'indice.) – AndreKR

risposta

3

ho trovato questo sito utile per ottimizzare il mio server MySQL: http://www.omh.cc/mycnf/

Esso consente di ottimizzare le variabili e so quale sarà la capacità totale della RAM. È necessario ottimizzare l'utilizzo della RAM del 60%. Quindi prova ad abbassare il tuo footprint di memoria totale a circa il 60% al 70% della RAM totale. Se hai altre cose in esecuzione sulla stessa macchina, probabilmente devi ridurre quel numero. Dimentica Query cache, non aggiungerà troppo valore, ma Table cache dovrebbe migliorare le tue prestazioni se fatto bene.

Provare a ridurre il numero di connessioni e mantenere il proprio ingombro di memoria totale inferiore al 60% della memoria totale del sistema.