query_cache_size ou query_cache_limit ou query_cache_min_res_unit ?

WRInaute accro
Bonjour

J'ai quasiment terminé de peaufiner le réglage de mon serveur mysql.

J'ai mis les réglages suivants hier, en suivant les conseils de tuning-primer.sh et mysqltuner.sh :

----------------------------------------------------------------------
skip-external-locking

max_connnections = 100

key_buffer_size = 512M
max_allowed_packet = 512M

thread_stack = 192K
thread_cache_size = 8

table_cache = 256
query_cache_size = 32M
query_cache_limit = 2M
query_cache_min_res_unit = 4K

read_buffer_size = 2M
sort_buffer_size = 2M

open_files_limit = 768
innodb_buffer_pool_size = 1G
-------------------------------------------------------------------------------

Voici ce que m'indiquent ce soir, les deux scripts :


-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -

MySQL Version 5.5.43-0+deb7u1 x86_64

Uptime = 0 days 21 hrs 49 min 36 sec
Avg. qps = 28
Total Questions = 2203986
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.5/en/server-system-variables.html
Visit http://---.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.000000 sec.
You have 1 out of 2204007 that take longer than 10.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 = 12
Current threads_cached = 10
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 = 11
The number of used connections is 11% of the configured maximum.
Your max_connections variable seems to be fine.

INNODB STATUS
Current InnoDB index space = 16 K
Current InnoDB data space = 48 K
Current InnoDB buffer pool free = 99 %
Current innodb_buffer_pool_size = 1.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 : 1.59 G
Configured Max Per-thread Buffers : 456 M
Configured Max Global Buffers : 1.54 G
Configured Max Memory Limit : 1.99 G
Physical Memory : 8.00 G
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 109 M
Current key_buffer_size = 512 M
Key cache miss rate is 1 : 217
Key buffer free ratio = 68 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 32 M
Current query_cache_used = 16 M
Current query_cache_limit = 2 M
Current Query cache Memory fill ratio = 52.54 %
Current query_cache_min_res_unit = 4 K
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 = 768 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 = 256 tables
Current table_definition_cache = 400 tables
You have a total of 96 tables
You have 141 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 16 M
Of 3078 temp tables, 7% were created on disk
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 2 M
Current table scan ratio = 1652 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 1 : 7445
Your table locking seems to be fine

root@vps21277:~/MySQL#

---------------------------------------------------------------------------------------------------------------------

> MySQLTuner 1.4.0 - Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://---.mysqltuner.com/
>> Run with '--help' for additional options and output filtering
[OK] Logged in using credentials from debian maintenance account.
[OK] Currently running supported MySQL version 5.5.43-0+deb7u1
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in MyISAM tables: 161M (Tables: 52)
[--] Data in InnoDB tables: 48K (Tables: 3)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[!!] Total fragmented tables: 10

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

-------- Performance Metrics -------------------------------------------------
[--] Up for: 21h 53m 14s (2M q [28.058 qps], 137K conn, TX: 636M, RX: 288M)
[--] Reads / Writes: 59% / 41%
[--] Total buffers: 1.6G global + 4.6M per thread (100 max threads)
[OK] Maximum possible memory usage: 2.0G (25% of installed RAM)
[OK] Slow queries: 0% (1/2M)
[OK] Highest usage of available connections: 11% (11/100)
[OK] Key buffer size / total MyISAM indexes: 512.0M/109.8M
[OK] Key buffer hit rate: 99.5% (15M cached / 69K reads)
[OK] Query cache efficiency: 74.8% (1M cached / 1M selects)
[!!] Query cache prunes per day: 191867
[OK] Sorts requiring temporary tables: 0% (16 temp sorts / 29K sorts)
[OK] Temporary tables created on disk: 8% (248 on disk / 3K total)
[OK] Thread cache hit rate: 99% (11 created / 137K connections)
[OK] Table cache hit rate: 94% (141 open / 149 opened)
[OK] Open file limit used: 25% (197/768)
[OK] Table locks acquired immediately: 99% (708K immediate / 708K locks)
[OK] InnoDB buffer pool / data size: 1.0G/48.0K
[OK] InnoDB log waits: 0
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
MySQL started within last 24 hours - recommendations may be inaccurate
Enable the slow query log to troubleshoot bad queries
Variables to adjust:
query_cache_size (> 32M)

-------------------------------------------------------------------------------------------

Donc, mysqltuner.sh m'indique d'augmenter le query_cache_size.

Mais... J'ai lu dans la doc MySQL, qu'il valait mieux, en cas de niveau excessif de "Query cache prunes per day", de diminuer query_cache_min_res_unit.

Augmenter le query_cache_size, ne va-t-il pas augmenter la fragmentation de mes tables MySQL ?

Merci beaucoup de vos réponses.

Respectueusement.
 
WRInaute accro
Bonjour

J'ajoute cette requête que j'ai faite cette après-midi, avant de mettre query_cache_min_res_unit à 2 :

-------------------------------------------------------------

Code:
mysql> SHOW STATUS LIKE 'Qcache%';
+-------------------------+----------+
| Variable_name           | Value    |
+-------------------------+----------+
| Qcache_free_blocks      | 4675     |
| Qcache_free_memory      | 15404312 |
| Qcache_hits             | 1221548  |
| Qcache_inserts          | 372071   |
| Qcache_lowmem_prunes    | 174977   |
| Qcache_not_cached       | 38262    |
| Qcache_queries_in_cache | 15507    |
| Qcache_total_blocks     | 35743    |
+-------------------------+----------+
8 rows in set (0.00 sec)

----------------------------------------------------------------

J'ai trouvé ce soir, une page intéressante indiquant l'heuristique pour fixer les paramètres.

Respectueusement.
 
Discussions similaires
Haut