Le Forum Non Officiel de la DEDIBOX
Vous n'êtes pas identifié.
Bonjour,
Voilà je vous explique mon cas que je n'ai pas trouvé la solution.
Je suis sur Systeme : GNU/Linux Debian 4.0r2 (Etch) i386 avec dedibox VL
Lors des heures de point mon site est inaccessible, erreur "too many connections"
Alors je fais mes recherche, apparamment ca vient de mysql. J'essaie de m'investir dans le fichier etc/mysql/my.cnf en augmentant le nombre de connections simultanées (de 100 à 256).
J'ai également trouvé ce tuning_primeur qui permettrait d'optimiser les performances de mon serveur.
Après 2 jours de réglage, le fichier my.cnf ne donne aucun résultat et le tuning primer non plus!!
J'ai essayé de le réinstallé à plusieurs reprise, il montre tjs le même chiffres malgré les modifications apportées il y a plus de 48h.
Et mon site toujours mort à plusieurs reprises dans une journée.
-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -
MySQL Version 5.0.32-Debian_7etch5-log i486
Uptime = 0 days 0 hrs 3 min 9 sec
Avg. qps = 3
Total Questions = 629
Threads Connected = 5
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 650 that take longer than 10 sec. to complete
Your long_query_time may be too high, I typically set this under 5 sec.
BINARY UPDATE LOG
The binary update log is enabled
WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 0
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 = 5
Historic max_used_connections = 5
The number of used connections is 5% 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
MEMORY USAGE
Max Memory Ever Allocated : 103 M
Configured Max Per-thread Buffers : 265 M
Configured Max Global Buffers : 90 M
Configured Max Memory Limit : 355 M
Physical Memory : 2.96 G
Max memory limit seem to be within acceptable norms
KEY BUFFER
Current MyISAM index space = 696 K
Current key_buffer_size = 64 M
Key cache miss rate is 1 : 9
Key buffer fill 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 = 16 M
Current query_cache_used = 119 K
Current query_cache_limit = 8 M
Current Query cache Memory fill ratio = .72 %
Current query_cache_min_res_unit = 4 K
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
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 191 tables
You have 64 open tables.
Current table_cache hit rate is 10%, 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 117 temp tables, 9% 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 = 2275 : 1
read_buffer_size seems to be fine
TABLE LOCKING
Current Lock Wait ratio = 0 : 830
Your table locking seems to be fineVOICI MON FICHIER my.cnf
...... [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 = 64M max_allowed_packet = 16M thread_stack = 128K thread_cache_size = 8 #max_connections = 256 #table_cache = 800 #thread_concurrency = 10 # # * Query Cache Configuration # query_cache_limit = 8M query_cache_size = 16M # # * 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 = 5 #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 = 16M [mysql] #no-auto-rehash # faster start of mysql but no tab completition [isamchk] key_buffer = 64M ......
Pourquoi les modifications n'ont pas d'effet? Ou je suis sur une fausse piste?
Quelqu'un aurait une idée, ça serait très sympa!
Merci
Dernière modification par dlphim (2008-05-03 23:21:49)
Hors ligne
La ligne est commentée... Enlève le #
Si tu n'utilises innodb, tu peux décommenter la ligne "#skip-innodb", ca te permettra d'économiser une bonne quantité de RAM.
Ca me parait bizarre que tu atteignes la limite des 100 connexions simultanées. Est-ce que tu fais des requêtes particulièrement lourdes consciemment ? C'est peut-être le signe que tes requêtes sont mal écrites ou que tes tables sont mal indexées.
Dernière modification par Thoranix (2008-05-04 02:46:07)
Hors ligne
Est ce que ton site, PHP je suppose, est fait maison ? Dans ce cas essaye de faire mysql_close(); a la fin de toutes les requettes SQL... si tu utilises des classes deja faites, genre PEAD:: DB, PEAR:: MDB2, fait appel a la fonction close() de ton objet $db.
Dernière modification par JalaL (2008-05-04 09:26:11)
Hors ligne
Rebonjour, et merci pour vos très utiles commentaires.
Effectivement, c'est une source en php fait maison. (je l'ai commandé à un codeur)
J'ai tjs l'impression qu'il rame depuis que je l'ai mis.
Désolé, mais j'avoue que je ne comprends pas que faire si vous me conseiller (décommenter la ligne "#skip-innodb"), je ne trouve pas la définition dans google et wikipédia
. Tous ce que je peux faire, c'est executer des commandes sous putty et autre commandes dépendants de google)
Je pense que je vais faire appel à mon codeur de modifier les codes du site, cependant si vous avez d'autres conseils seraient le bienvenue.
Je vous donne quand même mon site (phimshare.net) si vous voyer erreur! vous savez pourquoi? ![]()
Mais au faite, pourquoi max connections ne prend pas d'effet quand je le change??
-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -
MySQL Version 5.0.32-Debian_7etch5-log i486
Uptime = 0 days 13 hrs 23 min 48 sec
Avg. qps = 3
Total Questions = 168039
Threads Connected = 28
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 168060 that take longer than 10 sec. to complete
Your long_query_time may be too high, I typically set this under 5 sec.
BINARY UPDATE LOG
The binary update log is enabled
WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 0
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 = 98
Historic max_used_connections = 101
The number of used connections is 101% of the configured maximum.
You should raise max_connections
MEMORY USAGE
Max Memory Ever Allocated : 358 M
Configured Max Per-thread Buffers : 265 M
Configured Max Global Buffers : 90 M
Configured Max Memory Limit : 355 M
Physical Memory : 2.96 G
Max memory limit seem to be within acceptable norms
KEY BUFFER
Current MyISAM index space = 720 K
Current key_buffer_size = 64 M
Key cache miss rate is 1 : 594
Key buffer fill 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 = 16 M
Current query_cache_used = 9 M
Current query_cache_limit = 8 M
Current Query cache Memory fill ratio = 61.38 %
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 1 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 191 tables
You have 64 open tables.
Current table_cache hit rate is 3%, 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 2557 temp tables, 63% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
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 = 4076 : 1
You have a high ratio of sequential access requests to SELECTs
You may benefit from raising read_buffer_size and/or improving your use of indexes.
TABLE LOCKING
Current Lock Wait ratio = 1 : 2989
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'.Dernière modification par dlphim (2008-05-04 12:30:38)
Hors ligne
Lorsque je redemarre mysql, j'ai tjs ce message d'erreur!
/etc/init.d/mysql restart
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld.
Checking for corrupt, not cleanly closed and upgrade needing tables..
Cela viendrait de mon database? J'ai essayé de réparré les tables sans succès.
Faut savoir aussi que j'ai utilisé mysqldump pour bouger ma base, il semblerait que l'erreur vient de là!
Comment faire ??
Hors ligne
C'est pas une erreur, c'est juste le script debian mysqld_safe qui répare les tables et les optimises (il me semble) quand tu lance mysql.
Dernière modification par Mogui (2008-05-04 15:10:51)
Hors ligne
Mouais!
j'ai effecé la db et redemarre!! le message ne bouge pas!
Je ne comprends tjs pas lors que je lance tuning-preimer.sh, jai max connect 100 alors je l'ai modifié dans my.cnf il y a une semaine?![]()
Je suis sur plesk, cest bien ce fichier la: /etc/mysql/my.cnf ??
merci de votre aide!
Dernière modification par dlphim (2008-05-04 15:21:37)
Hors ligne
Est-ce que tu as enlevé le # (dièse) devant max_connections ?
Hors ligne
ohh! put...![]()
ca a marché!!!
j'suis c...
j'attends pour voir l'effet!
merci beauuucoupp!
Hors ligne
Ca n'améliorera pas vraiment les choses, le code de ton site semble être très lent (ou tu as vraiment beaucoup de monde sur le site, tu peux nous donner un nombre ?)
Hors ligne
son site est rapide chez moi ![]()
le seul problème c'est les images qui sont hébergées sur imageshack...
Hors ligne
Le serveur ne répondait plus. Au moment où j'écris les pages s'affichent assez vite.
Hors ligne
Au fait, il est à la fois rapide et lent!
ET CA M'ENERVE GRAVE!!!!
Le codeur dis avoir faire tous ce qu'il faut, même lui ne sais pas pourquoi???
il y que 1000 uniques visite/jour, et c'est minable...
J'ai remarqué qu'il prend 3 heures pour afficher la 1ere page, ensuite les pages qui suivent va vite et au bout de qq clicks il nous fait patienter.
Ce server, j'ai également fait du téléchargements...
Cela a t-il une influence sur le site???
Je pense que cela vient du code source ou du db, puisque le config du server est à présent correct.
Qu'en pensez-vous??
Regardez ca!
-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -
MySQL Version 5.0.32-Debian_7etch5-log i486
Uptime = 0 days 1 hrs 43 min 24 sec
Avg. qps = 2
Total Questions = 13787
Threads Connected = 168
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 = 5 sec.
You have 0 out of 13808 that take longer than 5 sec. to complete
Your long_query_time seems to be fine
BINARY UPDATE LOG
The binary update log is enabled
WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 0
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine
MAX CONNECTIONS
Current max_connections = 256
Current threads_connected = 168
Historic max_used_connections = 168
The number of used connections is 65% of the configured maximum.
Your max_connections variable seems to be fine.
MEMORY USAGE
Max Memory Ever Allocated : 504 M
Configured Max Per-thread Buffers : 679 M
Configured Max Global Buffers : 58 M
Configured Max Memory Limit : 737 M
Physical Memory : 2.96 G
Max memory limit seem to be within acceptable norms
KEY BUFFER
Current MyISAM index space = 254 K
Current key_buffer_size = 32 M
Key cache miss rate is 1 : 323
Key buffer fill 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 = 16 M
Current query_cache_used = 2 M
Current query_cache_limit = 8 M
Current Query cache Memory fill ratio = 18.22 %
Current query_cache_min_res_unit = 4 K
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
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 = 1866 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 = 800 tables
You have a total of 169 tables
You have 172 open tables.
The table_cache value seems to be fine
TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 32 M
Of 739 temp tables, 4% 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 = 1263 : 1
read_buffer_size seems to be fine
TABLE LOCKING
Current Lock Wait ratio = 1 : 3269
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'.Dernière modification par dlphim (2008-05-04 21:54:36)
Hors ligne
Idées :
Regarde le nombre de processus mysql actifs (grâce à la commande SHOW PROCESSLIST) et ce qu'ils font.
Place aussi un compteur sur certaines pages PHP grâce à la fonction microtime pour obtenir leur temps de génération, cela te donnera une idée de la lenteur d'exécution des scripts.
Hors ligne
chez moi la page d'accueil est rapide.
(enfin la première fois pour la mise en cache ... c'est vrai que c'est lent)
sinon ce qui fait allonger le temps de chargement c'est les images uploadées sur imageshack...
Hors ligne
Est ce que ton codeur utilise des connections persistantes à la base de données ? Est ce qu'il a rajouté mysql_close() à la fin de chaque page ? c'est une erreur tres courante chez les novices de ne pas fermer les connections mysql à la fin du script.
Hors ligne
oui mais ce n'est pas ça qui va créer cette différence.
php les ferme d'ailleurs automatiquement...
Hors ligne
connexion persistante, php/apache la gere mal, a eviter
Sinon regarde au niveau des parametres apache,
regarde ton "top" voir si il est élevé ou non
Hors ligne
Uptime = 0 days 1 hrs 43 min 24 sec
Avg. qps = 2
Total Questions = 13787
2 requêtes par secondes c'est rien du tout, c'est vrai que c'est louche. Je peux te conseiller un autre script: MysqlTuner.
Moi il m'a bien aidé. J'avais aussi ce problème, mais c'était du aux requetes pourries, mais comme je suis hébergeur, je controle pas comment les gens font leur requetes (des join sans indexes, le plus souvent...). Au final j'ai du changer la machine :S.
Hors ligne
Ok merci pour tous vos conseils, je sais pas ce que fais le codeur mais ça a l'air de bien repartis depuis..
Bravo à tous!!!
Hors ligne