Problème configuration MySQL / Apache

Problème configuration MySQL / Apache - Hébergement - Réseaux grand public / SoHo

Marsh Posté le 05-06-2011 à 14:32:44    

Bonjour à tous !
 
-> Il y a 2/3 jours, j'avais un serveur qui s'occupait de apache + mySQL (8Go de Ram, 4 coeurs)
-> Depuis hier, afin de mieux répondre aux demandes des visiteurs, ce serveur ne s'occupe plus que d'apache, ayant opté pour un VPS qui se charge seul de la base de données.
 
-> Config du premier serveur : EG-09 BestOF (Intel Xeon Quad 4x2.83, 8 Go DDR 2)
-> Config de base du VPS : 4Go de ram dédiée, 3 Ghz de CPU dédié (extensibles)
 
Ma demande concerne donc la configuration dans un premier temps d'apache, et dans un deuxième temps de my.cnf. De manière à maximiser l'efficacité de ces deux serveurs, en fonction des configs.
 
================
 
Pour le cas du premier serveur, voici quelques points apache :
 
 
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
ServerLimit 2000
MaxClients 1000
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_worker_module>
StartServers 2
ServerLimit 2000
MaxClients 1000
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>
 
Qu'en pensez-vous ?
 
===============
 
Pour le cas du deuxième serveur, idem mais requête supplémentaire : par moments, je compte augmenter les capacités du VPS pour gérer les périodes d'affluence, dans ce cas quelles variables changer et optimiser ?
Ensuite, voici ma config actuelle (my.cnf)
 
===============
 
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
 
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
 
[mysqld]
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/french
skip-external-locking
skip-innodb
max_connections = 300
key_buffer = 64M
join_buffer_size = 3M
max_allowed_packet = 32M
thread_stack = 128K
thread_cache_size = 8
myisam-recover = BACKUP
table_cache = 512
query_cache_limit = 8M
query_cache_size = 32M
read_rnd_buffer_size = 2M
sort_buffer_size = 3M
expire_logs_days = 10
max_binlog_size = 100M
myisam_sort_buffer_size = 64M
open_files_limit = 1536
max_heap_table_size = 32M
read_buffer_size = 3M
 
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
 
[mysql]
 
[isamchk]
key_buffer = 64M
 
!includedir /etc/mysql/conf.d/
 
 
===============
 
Un petit coup de MySQLTuner :
 
===============
 
-------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.0.51a-24+lenny5
[OK] Operating on 64-bit architecture
 
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +Archive -BDB +Federated -InnoDB -ISAM -NDBCluster
[--] Data in MyISAM tables: 288M (Tables: 186)
[!!] Total fragmented tables: 20
 
-------- Security Recommendations -------------------------------------------
[OK] All database users have passwords assigned
 
-------- Performance Metrics -------------------------------------------------
[--] Up for: 1d 15h 6m 28s (3M q [23.546 qps], 630K conn, TX: 125B, RX: 285M)
[--] Reads / Writes: 89% / 11%
[--] Total buffers: 138.0M global + 11.1M per thread (300 max threads)
[!!] Maximum possible memory usage: 3.4G (87% of installed RAM)
[OK] Slow queries: 0% (1/3M)
[OK] Highest usage of available connections: 7% (21/300)
[OK] Key buffer size / total MyISAM indexes: 64.0M/51.8M
[OK] Key buffer hit rate: 100.0% (220M cached / 24K reads)
[OK] Query cache efficiency: 43.1% (821K cached / 1M selects)
[!!] Query cache prunes per day: 214049
[!!] Sorts requiring temporary tables: 12% (43K temp sorts / 347K sorts)
[OK] Temporary tables created on disk: 1% (924 on disk / 49K total)
[OK] Thread cache hit rate: 99% (137 created / 630K connections)
[OK] Table cache hit rate: 98% (411 open / 417 opened)
[OK] Open file limit used: 39% (614/1K)
[OK] Table locks acquired immediately: 99% (1M immediate / 1M locks)
 
-------- Recommendations -----------------------------------------------------
General recommendations:
Run OPTIMIZE TABLE to defragment tables for better performance
Reduce your overall MySQL memory footprint for system stability
Enable the slow query log to troubleshoot bad queries
Variables to adjust:
query_cache_size (> 32M)
sort_buffer_size (> 2M)
read_rnd_buffer_size (> 1M)
 
 
===============
 
Un petit coup de Tuning Primer :
 
===============
 
-- MYSQL PERFORMANCE TUNING PRIMER --
- By: Matthew Montgomery -
 
MySQL Version 5.0.51a-24+lenny5 x86_64
 
Uptime = 1 days 15 hrs 7 min 27 sec
Avg. qps = 23
Total Questions = 3317623
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.0/...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 1 out of 3317644 that take longer than 10 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.0/...-recovery.html
 
WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 7
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine
 
MAX CONNECTIONS
Current max_connections = 300
Current threads_connected = 1
Historic max_used_connections = 21
The number of used connections is 7% 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
 
No InnoDB Support Enabled!
 
MEMORY USAGE
Max Memory Ever Allocated : 339 M
Configured Max Per-thread Buffers : 3.25 G
Configured Max Global Buffers : 106 M
Configured Max Memory Limit : 3.35 G
Physical Memory : 3.86 G
Max memory limit seem to be within acceptable norms
 
KEY BUFFER
Current MyISAM index space = 51 M
Current key_buffer_size = 64 M
Key cache miss rate is 1 : 9058
Key buffer free ratio = 44 %
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 = 32 M
Current query_cache_used = 17 M
Current query_cache_limit = 8 M
Current Query cache Memory fill ratio = 54.37 %
Current query_cache_min_res_unit = 4 K
Query Cache is 24 % fragmented
Run "FLUSH QUERY CACHE" periodically to defragment the query cache memory
If you have many small queries lower 'query_cache_min_res_unit' to reduce fragmentation.
MySQL won't cache query results that are larger than query_cache_limit in size
 
SORT OPERATIONS
Current sort_buffer_size = 3 M
Current read_rnd_buffer_size = 1 M
Sort buffer seems to be fine
 
JOINS
Current join_buffer_size = 3.00 M
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 = 1536 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 = 512 tables
You have a total of 203 tables
You have 411 open tables.
The table_cache value seems to be fine
 
TEMP TABLES
Current max_heap_table_size = 32 M
Current tmp_table_size = 32 M
Of 49206 temp tables, 1% were created on disk
Created disk tmp tables ratio seems fine
 
TABLE SCANS
Current read_buffer_size = 2 M
Current table scan ratio = 3676 : 1
read_buffer_size seems to be fine
 
TABLE LOCKING
Current Lock Wait ratio = 1 : 226
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'.
 
 
===============
 
 
Voilà donc !
Merci par avance à tous ceux qui voudront bien m'apporter leur aide :) (et même aux autres !)
 
Très bonne soirée.
 
Sébastien.

Reply

Marsh Posté le 05-06-2011 à 14:32:44   

Reply

Marsh Posté le 05-06-2011 à 14:39:14    

Ce sujet a été déplacé de la catégorie Systèmes & Réseaux Pro vers la categorie Réseaux grand public / SoHo par Je@nb

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed