Précédent   Forum des professionnels en informatique > Bases de données > MySQL > Administration
Administration Forum d'entraide sur l'administration de MySQL
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 01/03/2011, 15h02   #1
Invité régulier
 
Inscription : septembre 2006
Messages : 24
Détails du profil
Informations forums :
Inscription : septembre 2006
Messages : 24
Points : 6
Points : 6
Par défaut Problème performance Mysql/Linux/EzPublish

Bonjour,

Nous venons de mettre en place un site web sous EzPublish, et nous rencontrons malheureusement quelques soucis, notamment un problème de performance sur le serveur Mysql.

Etant plutôt habitué au monde Oracle, je dois avouer que j'essaye de chercher comme je peux avec notre ami google, mais ce n'est pas évident de s'y retrouver.

Voici le souci :
Depuis la mise en ligne, le serveur MySQL (sur un serveur Ubuntu) explose et le process affiche 200% de CPU Usage en moyenne. Le Load Average peut monter à 10...

J'ai tenté quelques améliorations mais un peu à l'aveugle...

Voici le top :
Code :
1
2
3
4
5
6
7
8
top - 16:58:24 up  2:25,  2 users,  LOAD average: 2.13, 2.39, 3.16
Tasks:  87 total,   1 running,  86 sleeping,   0 stopped,   0 zombie
Cpu(s): 95.0%us,  0.8%sy,  0.0%ni,  3.1%id,  0.0%wa,  0.2%hi,  1.0%si,  0.0%st
Mem:   2057692k total,  2041768k used,    15924k free,    24996k buffers
Swap:  1764344k total,     8932k used,  1755412k free,   573460k cached
 
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 1308 mysql     20   0 4016m 1.3g 7656 S  199 65.9  61:03.26 mysqld
Et voici le my.cnf
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
[client]
port            = 3306
socket          = /var/run/mysqld/mysqld.sock
 
# Here is entries for some specific programs
# The following values assume you have at least 32M ram
 
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket          = /var/run/mysqld/mysqld.sock
nice            = 0
 
[mysqld]
#
# * Basic Settings
#
 
#
# * IMPORTANT
#   If you make changes to these settings and your system uses apparmor, you may
#   also need to also adjust /etc/apparmor.d/usr.sbin.mysqld.
#
 
user            = mysql
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
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              = 1G
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 16
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
max_connections        = 550
table_cache            = 1024
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 256M
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
 
log_error                = /var/log/mysql/error.log
 
# Here you can see queries with especially long duration
log_slow_queries        = /var/log/mysql/mysql-slow.log
#long_query_time = 2
log-queries-not-using-indexes
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id              = 1
#log_bin                        = /var/log/mysql/mysql-bin.log
expire_logs_days        = 10
max_binlog_size         = 100M
#binlog_do_db           = include_database_name
#binlog_ignore_db       = include_database_name
#
# * 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!
#
# * 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
 
innodb_buffer_pool_size=2G
innodb_additional_mem_pool_size=50M
innodb_flush_log_at_trx_commit=2
 
[mysqldump]
quick
quote-names
max_allowed_packet      = 16M
 
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
 
[isamchk]
key_buffer              = 16M
 
#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
J'ai activé le trace sur les slow query, cela me donne le résultat suivant :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
donnees@LNX64BDD:~$ mysqldumpslow /var/log/mysql/mysql-slow.log -s t -t 5 -i agefiph > slow.txt
 
Reading mysql slow query log FROM /var/log/mysql/mysql-slow.log
donnees@LNX64BDD:~$ less slow.txt
Count: 8  Time=445.83s (3566s)  LOCK=0.00s (0s)  Rows=1.0 (8), agefiph[agefiph]@[10.222.114.195]
  SELECT
  count( DISTINCT ezcontentobject_tree.node_id ) AS count
  FROM
  ezcontentobject_tree,
  ezcontentobject,ezcontentclass
  , ezcontentobject_name
  ,ezcontentobject_link AS t0,ezcontentobject_link AS t1,ezcontentobject_link AS t2,ezcontentobject_link AS t3,ezcontentobject_link AS t4,ezcontentobject_link AS t5
  WHERE  ezcontentobject_tree.path_string LIKE 'S' AND
  ezcontentobject_tree.contentobject_id = t0.from_contentobject_id AND ezcontentobject_tree.contentobject_version = t0.from_contentobject_version AND  ezcontentobject_tree.contentobject_id=t1.from_contentobject_id AND ezcontentobject_tree.contentobject_version=t1.from_contentobject_version AND  ezcontentobject_tree.contentobject_id=t2.from_contentobject_id AND ezcontentobject_tree.contentobject_version=t2.from_contentobject_version AND  ezcontentobject_tree.contentobject_id=t3.from_contentobject_id AND ezcontentobject_tree.contentobject_version=t3.from_contentobject_version AND  ezcontentobject_tree.contentobject_id=t4.from_contentobject_id AND ezcontentobject_tree.contentobject_version=t4.from_contentobject_version AND  ezcontentobject_tree.contentobject_id=t5.from_contentobject_id AND ezcontentobject_tree.contentobject_version=t5.from_contentobject_version AND  (t0.contentclassattribute_id=N AND t0.to_contentobject_id=N OR t1.contentclassattribute_id=N AND t1.to_contentobject_id=N OR t2.contentclassattribute_id=N AND t2.to_contentobject_id=N OR t3.contentclassattribute_id=N AND t3.to_contentobject_id=N OR t4.contentclassattribute_id=N AND t4.to_contentobject_id=N OR t5.contentclassattribute_id=N AND t5.to_contentobject_id=N) AND
  ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id AND
  ezcontentobject.contentclass_id  IN  ( N ) AND
  ezcontentclass.version=N AND
  ezcontentobject_tree.node_id != N AND
  ezcontentobject_tree.contentobject_id = ezcontentobject.id  AND
  ezcontentclass.id = ezcontentobject.contentclass_id AND
  ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id AND
  ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version AND
  ( ezcontentobject_name.language_id & ezcontentobject.language_mask > N AND
  ( (   ezcontentobject.language_mask - ( ezcontentobject.language_mask & ezcontentobject_name.language_id ) ) & N )
  + ( ( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & ezcontentobject_name.language_id ) ) & N ) )
  <
  ( ezcontentobject_name.language_id & N )
  + ( ( ezcontentobject_name.language_id & N ) )
  )
  AND ezcontentobject_tree.is_invisible = N
  AND
  ezcontentobject.language_mask & N > N
 
Count: 8  Time=256.24s (2049s)  LOCK=0.00s (0s)  Rows=1.5 (12), agefiph[agefiph]@[10.222.114.195]
  SELECT DISTINCT
  ezcontentobject.*,
  ezcontentobject_tree.*,
  ezcontentclass.serialized_name_list AS class_serialized_name_list,
  ezcontentclass.identifier AS class_identifier,
  ezcontentclass.is_container AS is_container
  , ezcontentobject_name.name AS name,  ezcontentobject_name.real_translation
  FROM
  ezcontentobject_tree,
  ezcontentobject,ezcontentclass
  , ezcontentobject_name
  ,ezcontentobject_link AS t0,ezcontentobject_link AS t1,ezcontentobject_link AS t2,ezcontentobject_link AS t3,ezcontentobject_link AS t4,ezcontentobject_link AS t5
  WHERE
  ezcontentobject_tree.path_string LIKE 'S' AND
  ezcontentobject_tree.contentobject_id = t0.from_contentobject_id AND ezcontentobject_tree.contentobject_version = t0.from_contentobject_version AND  ezcontentobject_tree.contentobject_id=t1.from_contentobject_id AND ezcontentobject_tree.contentobject_version=t1.from_contentobject_version AND  ezcontentobject_tree.contentobject_id=t2.from_contentobject_id AND ezcontentobject_tree.contentobject_version=t2.from_contentobject_version AND  ezcontentobject_tree.contentobject_id=t3.from_contentobject_id AND ezcontentobject_tree.contentobject_version=t3.from_contentobject_version AND  ezcontentobject_tree.contentobject_id=t4.from_contentobject_id AND ezcontentobject_tree.contentobject_version=t4.from_contentobject_version AND  ezcontentobject_tree.contentobject_id=t5.from_contentobject_id AND ezcontentobject_tree.contentobject_version=t5.from_contentobject_version AND  (t0.contentclassattribute_id=N AND t0.to_contentobject_id=N OR t1.contentclassattribute_id=N AND t1.to_contentobject_id=N OR t2.contentclassattribute_id=N AND t2.to_contentobject_id=N OR t3.contentclassattribute_id=N AND t3.to_contentobject_id=N OR t4.contentclassattribute_id=N AND t4.to_contentobject_id=N OR t5.contentclassattribute_id=N AND t5.to_contentobject_id=N) AND
  ezcontentclass.version=N AND
  ezcontentobject_tree.node_id != N AND
  ezcontentobject_tree.contentobject_id = ezcontentobject.id  AND
  ezcontentclass.id = ezcontentobject.contentclass_id AND
   ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id AND
  ezcontentobject.contentclass_id  IN  ( N ) AND
  ezcontentobject_tree.contentobject_id = ezcontentobject_name.contentobject_id AND
  ezcontentobject_tree.contentobject_version = ezcontentobject_name.content_version AND
  ( ezcontentobject_name.language_id & ezcontentobject.language_mask > N AND
  ( (   ezcontentobject.language_mask - ( ezcontentobject.language_mask & ezcontentobject_name.language_id ) ) & N )
  + ( ( ( ezcontentobject.language_mask - ( ezcontentobject.language_mask & ezcontentobject_name.language_id ) ) & N ) )
  <
  ( ezcontentobject_name.language_id & N )
  + ( ( ezcontentobject_name.language_id & N ) )
  )
  AND ezcontentobject_tree.is_invisible = N
  AND
  ezcontentobject.language_mask & N > N
  ORDER BY ezcontentobject.published DESC
  LIMIT N, N
 
Count: 6  Time=37.68s (226s)  LOCK=0.00s (0s)  Rows=0.0 (0), agefiph[agefiph]@[10.222.114.195]
  INSERT INTO ezsearch_tmp_0 SELECT DISTINCT ezsearch_object_word_link.contentobject_id, ezsearch_object_word_link.published
  FROM ezcontentobject,
  ezsearch_object_word_link
  ,
  ezcontentclass,
  ezcontentobject_tree
  WHERE
  ezsearch_object_word_link.contentclass_id IN ( N ) AND
  ezcontentobject.id=ezsearch_object_word_link.contentobject_id AND
  ezcontentobject.contentclass_id = ezcontentclass.id AND
  ezcontentclass.version = 'S' AND
  ezcontentobject.id = ezcontentobject_tree.contentobject_id AND
  ezcontentobject_tree.node_id = ezcontentobject_tree.main_node_id
  AND ezcontentobject_tree.is_invisible = N
 
Count: 1  Time=148.01s (148s)  LOCK=0.00s (0s)  Rows=0.0 (0), debian-sys-maint[debian-sys-maint]@localhost
  SELECT count(*) INTO @discard FROM `information_schema`.`PARTITIONS`
 
Count: 1  Time=66.86s (66s)  LOCK=0.00s (0s)  Rows=49.0 (49), debian-sys-maint[debian-sys-maint]@localhost
  SELECT concat('S',
  TABLE_SCHEMA, 'S', TABLE_NAME, 'S')
  FROM information_schema.TABLES WHERE ENGINE='S'
Si quelqu'un a des pistes ou des actions à mener pour identifier le problème, je dois avouer que cela m'aiderait beaucoup...

Cactus.
Cactus est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 01/03/2011, 18h19   #2
Membre du Club
 
Inscription : mars 2005
Messages : 66
Détails du profil
Informations personnelles :
Âge : 39

Informations forums :
Inscription : mars 2005
Messages : 66
Points : 44
Points : 44
Salut,
Ton serveur n'a que 2go de RAM et tu as alloué trop de mémoire aux buffers globaux.
key_buffer = 1G
innodb_buffer_pool_size=2G
Du coup, tu peux faire swapper le serveur dès que tu commences à avoir beaucoup d'activité dessus,car les buffers "per session" vont aussi consommer de la ram.
Exécute mysqltuner.pl (http://blog.mysqltuner.com/) . Il te fera des précos de tuning, surtout te préviendras si tu mets des paramètres trop haut.

Quelles sont les valeurs des paramètres max_heap_table_size et tmp_table_size ?
au vue de la complexité des requêtes ezpublish (bcq de jointures, order by, group by, ...)mysql doit pouvoir créer le maximum de tables temporaires en ram et non sur disques. (http://dasini.net/blog/2010/05/28/au...ap_table_size/)

Le serveur est-il dédié à mysql ?
Quelles sont la volumétrie des bases ? et leur type MyISAM/innoDB ?
Quelle est la version de mysql ? Si tes tables sont en innodb, je te conseille de passer en mysql 5.5/innodb. Mysql a fait un gros travail d'optimisation de ce moteur de stockage et des benchs démontrent des gains de performances assez impressionnants.

Seb
__________________
DBA SQLServer, Oracle, Mysql, DB2, Postgresql
slefevre01 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 02/03/2011, 14h30   #3
Invité régulier
 
Inscription : septembre 2006
Messages : 24
Détails du profil
Informations forums :
Inscription : septembre 2006
Messages : 24
Points : 6
Points : 6
En effet, j'avais adapté le innodb_buffer_pool_size en fonction de la RAM, et j'étais persuadé qu'il y avait 4G

Résultat, j'ai mis finalement les 4G en ram, et j'avais pris comme directives pour Key_Buffer : 25% de la RAM, et Innodb_buffer : 50% de la RAM.

Après modification, voici ce que reporte mysqltuner :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
donnees@LNX64BDD:~/mysqltuner.pl$ perl mysqltuner.pl
 
 >>  MySQLTuner 1.0.1 - Major Hayden <major@mhtx.net>
 >>  Bug reports, feature requests, AND downloads at http://mysqltuner.com/
 >>  Run WITH '--help' FOR additional options AND output filtering
Please enter your MySQL administrative login: 
Please enter your MySQL administrative password:
 
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.41-3ubuntu12.3-log
[OK] Operating ON 64-bit architecture
 
-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 55M (Tables: 20)
[--] Data in InnoDB tables: 21G (Tables: 660)
[!!] Total fragmented TABLES: 660
 
-------- Performance Metrics -------------------------------------------------
[--] Up for: 5m 15s (191 q [0.606 qps], 68 conn, TX: 41K, RX: 12K)
[--] Reads / Writes: 100% / 0%
[--] Total buffers: 3.3G global + 2.7M per thread (550 max threads)
[!!] Maximum possible memory usage: 4.8G (122% of installed RAM)
[!!] Slow queries: 6% (13/191)
[OK] Highest usage of available connections: 0% (3/550)
[OK] KEY buffer size / total MyISAM indexes: 1.0G/4.6M
[!!] Query cache efficiency: 0.0% (0 cached / 120 selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring TEMPORARY TABLES: 0% (0 temp sorts / 1 sorts)
[OK] TEMPORARY TABLES created ON disk: 23% (48 ON disk / 206 total)
[OK] Thread cache hit rate: 95% (3 created / 68 connections)
[OK] TABLE cache hit rate: 24% (705 open / 2K opened)
[OK] Open file LIMIT used: 3% (87/2K)
[OK] TABLE locks acquired immediately: 100% (65 immediate / 65 locks)
[!!] InnoDB DATA size / buffer pool: 21.4G/2.0G
 
-------- 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
VARIABLES TO adjust:
  *** MySQL's maximum memory usage is dangerously high ***
  *** Add RAM before increasing MySQL buffer variables ***
    query_cache_limit (> 1M, or use smaller result sets)
    innodb_buffer_pool_size (>= 21G)
 
donnees@LNX64BDD:~/mysqltuner.pl$
Je dois avouer que mettre un buffer_pool_size à 21G ça me fait peur

J'ai passé aussi le query_cache_limit à 4M, bien que je ne sache pas vraiment comment le fixer. (Fixer la valeur puis relancer mysqltunner régulièrement ???)

Sinon, pour répondre :
Version Mysql : 5.1.41. Monter de version alors que l'on vient juste de passer en production, ça peut être un peu cavalier non ?
Le serveur est dédié à MySQL, il dessert 2 frontaux apache sur lesquel j'ai 3 nodes EzPublish (Prod, Preprod, Minisite)
Apparement les tables sont en Innodb, même si je n'ai pas trouvé comment en être sûr.

Voici la volumétrie de mes schémas Mysql :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
+--------------------+------------+-------------+------------+----------+--------------+
| schema_name        | total_size | data_used   | data_free  | pct_used | total_tables |
+--------------------+------------+-------------+------------+----------+--------------+
| information_schema | 0.01Mb     | 0.01Mb      | 0.00Mb     |   100.00 |           28 |
| mysql              | 0.60Mb     | 0.60Mb      | 0.00Mb     |   100.00 |           23 |
| Schema_obsolete    | 0.80Mb     | 0.80Mb      | 0.00Mb     |   100.00 |            2 |
| Schema PRD 1       | 431.80Mb   | -683.20Mb   | 1115.00Mb  |  -158.22 |            7 |
| Schema EZP PRD     | 6858.57Mb  | -22354.43Mb | 29213.00Mb |  -325.93 |          135 |
| Schema EZP PREPRD  | 6830.80Mb  | -22382.20Mb | 29213.00Mb |  -327.67 |          135 |
| Schema EZP Minisite| 4484.17Mb  | -24728.83Mb | 29213.00Mb |  -551.47 |          135 |
| Schema obsolete    | 3378.26Mb  | -25834.74Mb | 29213.00Mb |  -764.73 |          135 |
| Schema obsolete    | 2154.92Mb  | -27058.08Mb | 29213.00Mb | -1255.64 |          131 |
+--------------------+------------+-------------+------------+----------+--------------+
Cactus est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 02/03/2011, 15h22   #4
Membre du Club
 
Inscription : mars 2005
Messages : 66
Détails du profil
Informations personnelles :
Âge : 39

Informations forums :
Inscription : mars 2005
Messages : 66
Points : 44
Points : 44
Salut,
pour connaître le type de table:

Code :
SELECT TABLE_SCHEMA,TABLE_NAME,ENGINE FROM TABLES;
- c'est clair qu'il ne faut pas mettre l'innodb_buffer_size à 21Go ;-)
- tu ne semble pas avoir de tables myisam (KEY buffer size / total MyISAM indexes: 1.0G/4.6M) Tu peux te permettre de descendre la key_buffer_size à 128m par exemple). Et donc d'augmenter un peu l'innodb_buffer_size.
- Tu as 23% de tables temporaires créées sur disk, n'hésite à augmenter les paramètres max_heap_table_size et tmp_table_size.

Quelles sont les valeurs de: sort_buffer_size, read_buffer_size, read_rnd_buffer_size, join_buffer_size ?

Est-ce un site à forte affluence ? As-tu constater des locks lorsque le serveur monte en charge ?
As-tu des indicateurs sur l'activité mysql ? nb de select/insert/update/delete par secondes, etc ... (Cacti à un template Mysql très bien fait pour tracer l'activité d'une instance mysql ?

Seb
__________________
DBA SQLServer, Oracle, Mysql, DB2, Postgresql
slefevre01 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 02/03/2011, 16h24   #5
Invité régulier
 
Inscription : septembre 2006
Messages : 24
Détails du profil
Informations forums :
Inscription : septembre 2006
Messages : 24
Points : 6
Points : 6
Voici la répartition des tables MyISAM Et InnoDB :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
+--------------------+--------+----------+
| table_schema       | engine | count(*) |
+--------------------+--------+----------+
| Schema_obsolete 1  | MyISAM |        2 |
| Schema obsolete 2  | InnoDB |      131 |
| Schema PRD 1       | InnoDB |        5 |
| Schema PRD 1       | MyISAM |        2 |
| Schema EZP Minisite| InnoDB |      131 |
| Schema EZP Minisite| MyISAM |        4 |
| Schema EZP PREPRD  | InnoDB |      131 |
| Schema EZP PREPRD  | MyISAM |        4 |
| Schema EZP PRD     | InnoDB |      131 |
| Schema EZP PRD     | MyISAM |        4 |
| Schema obsolete 3  | InnoDB |      131 |
| Schema obsolete 3  | MyISAM |        4 |
| information_schema | MEMORY |       20 |
| information_schema | MyISAM |        8 |
| mysql              | CSV    |        2 |
| mysql              | MyISAM |       21 |
+--------------------+--------+----------+
J'ai donc adapté un peu key_buffer_size et innodb_buffer_size, tout comme max_heap_table_size et tmp_table_size.

Voici les valeurs anciennes et nouvelles sur les différents paramètres :
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
+----------------------+----------+----------+
| Variable_name        | Value    | Cible ?  |
+----------------------+----------+----------+
| max_heap_table_size  | 16M      | 64M      |
+----------------------+----------+----------+
| tmp_table_size       | 16M      | 64M      |
+----------------------+----------+----------+
| sort_buffer_size     | 2M       | 8M       |
+----------------------+----------+----------+
| read_buffer_size     | 128k     | 1M       |
+----------------------+----------+----------+
| read_rnd_buffer_size | 256k     | 2M       |
+----------------------+----------+----------+
| join_buffer_size     | 128k     | 1M       |
+----------------------+----------+----------+
| InnoDB_buffer_size   | 2G       | 3G       |
+----------------------+----------+----------+
| key_buffer_size      | 1G       | 128M     |
+----------------------+----------+----------+
Je vais laisser tourner un peu le site histoire de voir si cette fois ci cela tiendra.

C'est un site institutionnel avec une affluence qui peut aller aux alentours de 90 000 utilisateurs par jour lorsqu'il y a des campagnes / newsletter.

Comment je constate les locks ? Pour superviser l'activité de la base, je ne me suis pas encore renseigné du comment ça marche exactement, il faut que je vois si on peut intégrer le template Mysql au Cacti que l'on a en place actuellement.
Cactus est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 02/03/2011, 16h43   #6
Membre du Club
 
Inscription : mars 2005
Messages : 66
Détails du profil
Informations personnelles :
Âge : 39

Informations forums :
Inscription : mars 2005
Messages : 66
Points : 44
Points : 44
Les valeurs que vous avez misent sont très correctes.

Un exemple de script pour monitorer les locks:

Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh
###### verifie la presence de locks
 
ROOTPASS='xxxxxxx'
HOST='localhost'
PORT='3306'
CHEMINLOGS='/home/toto/mysql/'
IP=''
nblock_alert_limit='2'
lock_max_time_alert_limit='10'
 
 
echo "show processlist;" | /usr/LOCAL/mysql/bin/mysql -uroot -p$ROOTPASS -h$HOST -P$PORT > $CHEMINLOGS/check_lock.log
 
nblock=`cat $CHEMINLOGS/check_lock.log | grep -v Sleep | grep Locked | wc -l`
lock_max_time=`cat $CHEMINLOGS/check_lock.log | grep -v Sleep | grep Locked  | awk '{print $6}' | sort -n | tail -1`
 
# envoi d un mail si il y a plus de nblock_alert_limit lock durant depuis plus de lock_max_time_alert_limit secondes
 
IF [ $nblock -gt $nblock_alert_limit ] && [ $lock_max_time -gt $lock_max_time_alert_limit ]
 then
      mailx -s "MYSQL $CLIENT $IP : probleme de locks" toto@yahoo.fr < $CHEMINLOGS/check_lock.log
      cp  $CHEMINLOGS/check_lock.log $CHEMINLOGS/check_lock.log`date +%Y%m%d_%H_%M_%S`
fi
 
find $CHEMINLOGS -atime +60 -name check_lock.log* -exec rm {} \;

Au regard des requêtes construites pas Ezpublish (transmises dans votre premier post), et en lisant l'article suivant, http://www.media-business.biz/conten...nfer-du-devoir, il y a de quoi se faire des frayeurs avec ce cms sur des sites à forte affluence.

Seb
__________________
DBA SQLServer, Oracle, Mysql, DB2, Postgresql
slefevre01 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 02/03/2011, 17h27   #7
Invité régulier
 
Inscription : septembre 2006
Messages : 24
Détails du profil
Informations forums :
Inscription : septembre 2006
Messages : 24
Points : 6
Points : 6
Je vais commencer à surveiller un peu plus en détail maintenant que j'ai fixé ces paramètres...

Par rapport au script mysqltuner, je suppose que si je fais le ménage dans les schémas obsolètes il devrait adapter son rapport.

Par contre, comme il me dit que toutes les tables InnoDB son fragmentées, faut-il faire une defrag régulièrement ? (avec optimize table si j'ai bien lu)

Et tant que la ligne concernant les tables temporaires créées sur disque est en warning, je peux augmenter le tmp_table_size et max_heap_table_size ? Il y a des limites pour ces paramètres ?

Merci pour l'aide en tout cas !
Cactus est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 02/03/2011, 20h13   #8
Membre du Club
 
Inscription : mars 2005
Messages : 66
Détails du profil
Informations personnelles :
Âge : 39

Informations forums :
Inscription : mars 2005
Messages : 66
Points : 44
Points : 44
Citation:
Envoyé par Cactus Voir le message
Je vais commencer à surveiller un peu plus en détail maintenant que j'ai fixé ces paramètres...

Par rapport au script mysqltuner, je suppose que si je fais le ménage dans les schémas obsolètes il devrait adapter son rapport.
Oui, tout à fait.

Citation:
Envoyé par Cactus Voir le message
Par contre, comme il me dit que toutes les tables InnoDB son fragmentées, faut-il faire une defrag régulièrement ? (avec optimize table si j'ai bien lu)
Attention, l'optimize pose un lock sur les tables. A faire en heures creuses, et à tester sur une base de préprod avant.

Citation:
Envoyé par Cactus Voir le message
Et tant que la ligne concernant les tables temporaires créées sur disque est en warning, je peux augmenter le tmp_table_size et max_heap_table_size ? Il y a des limites pour ces paramètres ?
Merci pour l'aide en tout cas !
Attention de ne pas trop l'augmenter tout de même, vu que tu n'as que 4Go de Ram, je n'irais pas au delà des 256Mo. Mais bon, faut tester et augmenter au fur et à mesure en surveillant l'évolution de la ram et du swap.

Ton serveur est un physique ou une VM ?
__________________
DBA SQLServer, Oracle, Mysql, DB2, Postgresql
slefevre01 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 03/03/2011, 16h14   #9
Invité régulier
 
Inscription : septembre 2006
Messages : 24
Détails du profil
Informations forums :
Inscription : septembre 2006
Messages : 24
Points : 6
Points : 6
Pour l'optimize, je le note. Je verrai ce que je peux faire ce week end à ce sujet quand il n'y aura plus d'activité sur la preprod.

Je suis passé à 128M pour les deux paramètres, et idem ce week end je verrai pour rajouter 4Go de swap en plus.

Nous sommes sur des VM
Cactus est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/03/2011, 15h05   #10
Invité de passage
 
Inscription : mars 2011
Messages : 1
Détails du profil
Informations forums :
Inscription : mars 2011
Messages : 1
Points : 1
Points : 1
Salut Cactus,

Merci Seb pour toutes ces infos.

Je viens de suivre un livre sur l'optimisation des performances des applications web. Je pense que cela pourrait t'aider, notamment au niveau du cheminement.

Pour le télécharger : Améliorer vos performances web.
Ce que tu cherches sur le SQL se trouve dans le livre 4, mais la démarche est également intéressante.

Nico
n.peguin est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/03/2011, 15h17   #11
Membre du Club
 
Inscription : mars 2005
Messages : 66
Détails du profil
Informations personnelles :
Âge : 39

Informations forums :
Inscription : mars 2005
Messages : 66
Points : 44
Points : 44
Citation:
Envoyé par Cactus Voir le message

Nous sommes sur des VM
Salut,
Ta VM a combien de vCPU ? Si tu n'en a qu'un seul, je te conseille d'en déclarer 2 pour diminuer le load average.
Il paraît qu'il ne faut trop en mettre (de vcpu) car ca peut-être contre-performant(si le système hôte est déjà très sollicité en terme de CPU. Ca génère des attentes cpu)

Tu parles d'ajouter 4Go de swap. Ajoute plutôt 4Go de RAM au vue de la volumétrie de tes bases.

T'es sur Vmware ?

Seb
__________________
DBA SQLServer, Oracle, Mysql, DB2, Postgresql
slefevre01 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 08/03/2011, 09h28   #12
Invité régulier
 
Inscription : septembre 2006
Messages : 24
Détails du profil
Informations forums :
Inscription : septembre 2006
Messages : 24
Points : 6
Points : 6
Bonjour,

La VM a déjà 2 Vcpu, et ce n'est effectivement pas conseillé d'en déclarer plus à moins de faire de la réservation de coeur pour cette machine, et de l'exclusion pour toutes les autres... Nous sommes effectivement sous VmWare

J'ai rajouté 4 Go de ram, le site est toujours aussi lent mais la base ne tombe plus. Apparement, il y a un problème de cache sur le dev EzPublish qui a été fait, ce qui augmente de manière drastique le nombre de requêtes sql effectuées pour afficher une page, et donc surcharge la base.

Maintenant que cette dernière ne tombe plus, je vais pouvoir faire remonter ce problème de cache.
Cactus est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 14h44.


 
 
 
 
Partenaires

Hébergement Web