Optimisations Mysql serveur dédié
Salut à tous,
On trouve régulièrement des astuces pour optimiser son serveur Mysql mais souvent les conseils sont données par rapport à de tout petit serveur (1-2Go de ram + petit CPU).
Mon serveur dédié à 24Go de Ram et un Intel Xeon.
Il a une charge assez forte avec une trentaine de site (nginx/apache/php/mysql) + environ 1000 boites emails (postifx en POP/IMAP).
Au niveau du CPU il supporte la charge et la bande passante n'est pas saturée.
J'essaye d'optimiser les performances mysql mais je n'arrive pas à faire le bon réglage.
Voici le résultat d'un tuning-primer.sh:
C'est surtout la partie TABLE CACHE et TEMP CACHE que je n'arrive pas à optimiser.
Merci par avance
On trouve régulièrement des astuces pour optimiser son serveur Mysql mais souvent les conseils sont données par rapport à de tout petit serveur (1-2Go de ram + petit CPU).
Mon serveur dédié à 24Go de Ram et un Intel Xeon.
Il a une charge assez forte avec une trentaine de site (nginx/apache/php/mysql) + environ 1000 boites emails (postifx en POP/IMAP).
Au niveau du CPU il supporte la charge et la bande passante n'est pas saturée.
J'essaye d'optimiser les performances mysql mais je n'arrive pas à faire le bon réglage.
Voici le résultat d'un tuning-primer.sh:
-- MYSQL PERFORMANCE TUNING PRIMER -- - By: Matthew Montgomery - MySQL Version 5.1.61-log x86_64 Uptime = 6 days 16 hrs 41 min 59 sec Avg. qps = 36 Total Questions = 20904053 Threads Connected = 18 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.1/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 enabled. Current long_query_time = 5.000000 sec. You have 171514 out of 20904081 that take longer than 5.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.1/en/point-in-time-recovery.html WORKER THREADS Current thread_cache_size = 132 Current threads_cached = 49 Current threads_per_sec = 0 Historic threads_per_sec = 0 Your thread_cache_size is fine MAX CONNECTIONS Current max_connections = 400 Current threads_connected = 19 Historic max_used_connections = 68 The number of used connections is 17% of the configured maximum. Your max_connections variable seems to be fine. MEMORY USAGE Max Memory Ever Allocated : 2.71 G Configured Max Per-thread Buffers : 1.22 G Configured Max Global Buffers : 2.50 G Configured Max Memory Limit : 3.73 G Physical Memory : 23.59 G Max memory limit seem to be within acceptable norms KEY BUFFER 1705419 * 1024 / 2147483648 * 100 Current MyISAM index space = 581 M Current key_buffer_size = 2.00 G Key cache miss rate is 1 : 272 Key buffer free ratio = 0 % 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 = 512 M Current query_cache_used = 443 M Current query_cache_limit = 1.00 G Current Query cache Memory fill ratio = 86.64 % Current query_cache_min_res_unit = 4 K However, 713741 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 = 1 M Current read_rnd_buffer_size = 768 K Sort buffer seems to be fine JOINS Current join_buffer_size = 132.00 K You have had 1875 queries where a join could not use an index properly You have had 335 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 = 10410 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 = 4500 tables You have a total of 5124 tables You have 5000 open tables. Current table_cache hit rate is 28%, while 100% of your table cache is in use You should probably increase your table_cache You should probably increase your table_definition_cache value. TEMP TABLES Current max_heap_table_size = 1.00 G Current tmp_table_size = 1.00 G Of 271837 temp tables, 46% 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 = 1 M Current table scan ratio = 406 : 1 read_buffer_size seems to be fine TABLE LOCKING Current Lock Wait ratio = 1 : 3813 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'.
C'est surtout la partie TABLE CACHE et TEMP CACHE que je n'arrive pas à optimiser.
Merci par avance
A voir également:
- Optimisations Mysql serveur dédié
- Changer serveur dns - Guide
- Serveur dns gratuit - Guide
- Serveur entrant et sortant - Guide
- Mysql community server - Télécharger - Bases de données
- Serveur dns orange - Accueil - Guide box et connexion Internet
1 réponse
Je ne sais pas si c'est adapté à tes besoins, mais il existe des outils comme mysqltuner qui t'aident à optimiser la configuration d'un serveur mysql :
https://raw.githubusercontent.com/rackerhacker/MySQLTuner-perl/master/mysqltuner.pl
Maintenant si on regarde les résultats de ton outil, on voit :
A priori je dirais qu'il suffit de corriger/augmenter ces valeurs dans /etc/mysql/my.cnf, puis relancer le serveur mysql :
Bonne chance
https://raw.githubusercontent.com/rackerhacker/MySQLTuner-perl/master/mysqltuner.pl
Maintenant si on regarde les résultats de ton outil, on voit :
You should probably increase your table_cache You should probably increase your table_definition_cache value. [...] Perhaps you should increase your tmp_table_size and/or max_heap_table_size to reduce the number of disk-based temporary tables
A priori je dirais qu'il suffit de corriger/augmenter ces valeurs dans /etc/mysql/my.cnf, puis relancer le serveur mysql :
/etc/init.d/mysql restart
Bonne chance