IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Administration MySQL Discussion :

Load average très élevé


Sujet :

Administration MySQL

  1. #1
    Futur Membre du Club
    Profil pro
    Inscrit en
    Août 2007
    Messages
    20
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 20
    Points : 8
    Points
    8
    Par défaut Load average très élevé
    Bonjour,

    J'ai depuis quelques temps un load average très élevé sur mon serveur, mes sites tournent quand même, mais j'aimerai réduire la charge.
    J'avais il y a quelques temps réussi à réduire la charge grâce à un simple redirect 503 des bots lorsque le load average dépassait 3, mais cette méthode n''est pas idéal.
    Depuis j'ai enlever cette limitation et augmenter la sécurité de mon serveur avec quelques modules : mod_security, mod_evasive, Cband, fail2ban et quelques règles de firewall.
    Depuis mon load oscille entre 2 et 40 durant la journée et soirée

    Voici la plupart de mes configs serveur, vu que j'ai pas mal bidouiller dans tous les sens, il y a peut être des incohérences ou erreur qui vont sauter aux yeux à certains, si c'est le cas n'hésiter pas !

    Merci
    Distribution
    • Linux ns307646.ovh.net 2.6.32.2-xxxx-grs-ipv4-64 #1 SMP Tue Dec 29 14:41:12 UTC 2009 x86_64 Intel(R) Core(TM) i5 CPU 750 @ 2.67GHz GenuineIntel GNU/Linux
    • MySQL Version 5.0.44-log x86_64
    • PHP Version 5.2.5-pl1-gentoo


    #mysqladmin status
    Uptime: 922 Threads: 6 Questions: 180988 Slow queries: 96 Opens: 169 Flush tables: 1 Open tables: 159 Queries per second avg: 196.299

    Apache status
    Current Time: Thursday, 08-Jul-2010 10:49:03 CEST
    Restart Time: Thursday, 08-Jul-2010 03:11:23 CEST
    Parent Server Generation: 6
    Server uptime: 7 hours 37 minutes 40 seconds
    Total accesses: 122113 - Total Traffic: 176.5 GB
    CPU Usage: u11.87 s.45 cu87.76 cs0 - .364% CPU load
    4.45 requests/sec - 6.6 MB/second - 1.5 MB/request
    41 requests currently being processed, 22 idle workers

    CC_KCWWCKK__W__K..CWCK__K____._KKWKKK__CWWKWWKWC_KKWC_CK_KWWW___
    __..................................


    #top

    top - 10:51:19 up 1 day, 13:39, 1 user, load average: 11.31, 5.22, 3.53
    Tasks: 244 total, 2 running, 239 sleeping, 0 stopped, 3 zombie
    Cpu0 : 82.8% us, 13.3% sy, 0.0% ni, 3.6% id, 0.0% wa, 0.0% hi, 0.3% si
    Cpu1 : 85.2% us, 9.2% sy, 0.0% ni, 3.0% id, 2.6% wa, 0.0% hi, 0.0% si
    Cpu2 : 83.6% us, 9.2% sy, 0.0% ni, 2.6% id, 0.7% wa, 0.0% hi, 3.9% si
    Cpu3 : 81.8% us, 8.3% sy, 0.0% ni, 2.6% id, 7.3% wa, 0.0% hi, 0.0% si
    Mem: 8183796k total, 6795712k used, 1388084k free, 472764k buffers
    Swap: 1047728k total, 95476k used, 952252k free, 4476520k cached


    #free -m
    total used free shared buffers cached
    Mem: 7991 5970 2021 0 626 3809
    -/+ buffers/cache: 1534 6457
    Swap: 1023 80 942

    ./mysqltuner.sh
    (pas encore très utile vu le uptime)

    >> 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

    -------- General Statistics --------------------------------------------------
    [--] Skipped version check for MySQLTuner script
    [OK] Currently running supported MySQL version 5.0.44-log
    [OK] Operating on 64-bit architecture

    -------- Storage Engine Statistics -------------------------------------------
    [--] Status: -Archive -BDB -Federated -InnoDB -ISAM -NDBCluster
    [--] Data in MyISAM tables: 3G (Tables: 342)
    [--] Data in MEMORY tables: 1008K (Tables: 14)
    [!!] Total fragmented tables: 43

    -------- Performance Metrics -------------------------------------------------
    [--] Up for: 38m 22s (418K q [181.853 qps], 8K conn, TX: 243M, RX: 66M)
    [--] Reads / Writes: 83% / 17%
    [--] Total buffers: 2.2G global + 4.2M per thread (100 max threads)
    [OK] Maximum possible memory usage: 2.6G (33% of installed RAM)
    [OK] Slow queries: 0% (254/418K)
    [OK] Highest usage of available connections: 56% (57/100)
    [OK] Key buffer size / total MyISAM indexes: 2.0G/2.0G
    [OK] Key buffer hit rate: 100.0% (1B cached / 522K reads)
    [OK] Query cache efficiency: 77.4% (166K cached / 215K selects)
    [OK] Query cache prunes per day: 0
    [!!] Sorts requiring temporary tables: 13% (2K temp sorts / 17K sorts)
    [!!] Joins performed without indexes: 75
    [OK] Temporary tables created on disk: 11% (4K on disk / 36K total)
    [OK] Thread cache hit rate: 99% (57 created / 8K connections)
    [OK] Table cache hit rate: 97% (491 open / 505 opened)
    [OK] Open file limit used: 31% (839/2K)
    [OK] Table locks acquired immediately: 99% (92K immediate / 93K locks)

    -------- Recommendations -----------------------------------------------------
    General recommendations:
    Run OPTIMIZE TABLE to defragment tables for better performance
    MySQL started within last 24 hours - recommendations may be inaccurate
    Adjust your join queries to always utilize indexes
    Variables to adjust:
    sort_buffer_size (> 1023K)
    read_rnd_buffer_size (> 508K)
    join_buffer_size (> 2.0M, or always use indexes with joins)


    tuning-primer.sh ?
    (pas encore très utile vu le uptime)

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

    MySQL Version 5.0.44-log x86_64

    Uptime = 0 days 0 hrs 19 min 28 sec
    Avg. qps = 202
    Total Questions = 236813
    Threads Connected = 8

    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 enabled.
    Current long_query_time = 2 sec.
    You have 129 out of 236846 that take longer than 2 sec. to complete
    Your long_query_time seems to be fine

    BINARY UPDATE LOG
    The binary update log is enabled
    Binlog sync is not enabled, you could loose binlog records during a server crash

    WORKER THREADS
    Current thread_cache_size = 64
    Current threads_cached = 22
    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 = 25
    The number of used connections is 25% of the configured maximum.
    Your max_connections variable seems to be fine.

    MEMORY USAGE
    Max Memory Ever Allocated : 2.23 G
    Configured Max Per-thread Buffers : 426 M
    Configured Max Global Buffers : 2.13 G
    Configured Max Memory Limit : 2.55 G
    Physical Memory : 7.80 G
    Max memory limit seem to be within acceptable norms

    KEY BUFFER
    Current MyISAM index space = 1.97 G
    Current key_buffer_size = 2.00 G
    Key cache miss rate is 1 : 1529
    Key buffer free ratio = 71 %
    Your key_buffer_size seems to be fine

    QUERY CACHE
    Query cache is enabled
    Current query_cache_size = 128 M
    Current query_cache_used = 19 M
    Current query_cache_limit = 2 M
    Current Query cache Memory fill ratio = 15.28 %
    Current query_cache_min_res_unit = 2 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 = 1 M
    Current read_rnd_buffer_size = 508 K
    Sort buffer seems to be fine

    JOINS
    Current join_buffer_size = 2.00 M
    You have had 34 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 = 2670 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 = 1280 tables
    You have a total of 373 tables
    You have 448 open tables.
    The table_cache value seems to be fine

    TEMP TABLES
    Current max_heap_table_size = 64 M
    Current tmp_table_size = 64 M
    Of 20319 temp tables, 11% were created on disk
    Created disk tmp tables ratio seems fine

    TABLE SCANS
    Current read_buffer_size = 508 K
    Current table scan ratio = 5145 : 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 : 130
    You may benefit from selective use of InnoDB.


    Configuration httpd.conf
    Timeout 20
    KeepAlive On
    MaxKeepAliveRequests 200
    KeepAliveTimeout 10

    <IfModule prefork.c>
    MaxClients 200
    ServerLimit 100
    StartServers 4
    MinSpareServers 1
    MaxSpareServers 8
    MaxRequestsPerChild 1000
    </IfModule>

    <IfModule mod_evasive20.c>
    DOSHashTableSize 3097
    DOSPageCount 2
    DOSSiteCount 50
    DOSPageInterval 1
    DOSSiteInterval 1
    DOSBlockingPeriod 10
    DOSEmailNotify "xxx@gmail.com"
    DOSWhiteList 127.0.0.1
    DOSWhitelist 66.249.65.*
    DOSWhitelist 66.249.66.*
    DOSWhitelist 66.249.67.*
    DOSLogDir "/var/log/evasive/"
    #DOSSystemCommand "sudo -u nobody /sbin/iptables -I INPUT -s %s -j DROP"
    DOSSystemCommand "/bin/echo %s >> /var/log/evasive/dos_evasive.log && /bin/date >> /var/log/evasive/dos_evasive.log"
    </IfModule>

    Module Cband, activé pour chaque site hébergé
    CBandRemoteSpeed 2048 32 6


    MRTG
    http://ns307646.ovh.net/cgi-bin/mrtg.cgi/


    Configuration my.cnf
    skip-locking
    skip-networking
    skip-bdb
    skip-innodb

    character-set-server = utf8
    default-character-set = utf8
    user = mysql
    port = 3306
    basedir = /usr
    datadir = /var/lib/mysql
    socket = /var/run/mysqld/mysqld.sock
    pid-file = /var/run/mysqld/mysqld.pid
    language = /usr/share/mysql/english

    max_connections = 100
    interactive_timeout = 25
    wait_timeout = 10
    connect_timeout = 5
    max_connect_errors = 10

    max_allowed_packet = 16M
    table_cache = 1280
    open_files_limit = 2560
    max_heap_table_size = 64M
    tmp_table_size = 64M

    key_buffer = 2048M
    join_buffer_size = 2M
    #record_buffer = 8M
    sort_buffer_size = 1M
    read_rnd_buffer_size = 512K
    read_buffer_size = 512K
    myisam_sort_buffer_size = 4M
    thread_cache_size = 64

    query_cache_size = 128M
    query_cache_limit = 2M
    query_cache_min_res_unit = 2Ko

    thread_concurrency = 8
    low_priority_updates = 1
    concurrent_insert = 2
    max_write_lock_count = 1

    ft_min_word_len = 3
    ft_max_word_len = 64

    expire_logs_days = 7
    long_query_time = 2
    log-error = /var/log/mysql/mysqld.err
    log-slow-queries = /var/log/mysql/slow-query.log
    log_warnings
    #log_queries_not_using_indexes


    Configuration php.ini
    max_execution_time = 20
    max_input_time = 30
    memory_limit = 8M

  2. #2
    Futur Membre du Club
    Profil pro
    Inscrit en
    Août 2007
    Messages
    20
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 20
    Points : 8
    Points
    8
    Par défaut
    J'essaye depuis quelques jours de maintenir mysql up pendant plus de 24h mais impossible, je vais avoir du mal à vous fournir un tunning-primmer ou mysqltunner correct
    J'ai réussi un up de 8h maximum de mysql pour le moment :X

  3. #3
    Futur Membre du Club
    Profil pro
    Inscrit en
    Août 2007
    Messages
    20
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 20
    Points : 8
    Points
    8
    Par défaut
    je viens de remarquer quelque chose de louche au niveau de l'utilisation du CPU par certain process mort de php.

    #ps aux | grep user_web
    USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
    user_web 21821 0.0 0.0 60120 7628 ? S 17:24 0:00 /usr/local/php5/bin/php
    user_web 21822 0.0 0.0 60120 7628 ? S 17:24 0:00 /usr/local/php5/bin/php
    user_web 21839 0.0 0.0 60120 7628 ? S 17:24 0:00 /usr/local/php5/bin/php
    user_web 21840 0.0 0.0 60120 7628 ? S 17:24 0:00 /usr/local/php5/bin/php
    user_web 21932 38.0 0.0 0 0 ? Z 17:24 0:00 [php] <defunct>
    user_web 21933 37.0 0.0 0 0 ? Z 17:24 0:00 [php] <defunct>
    user_web 21934 38.0 0.0 0 0 ? Z 17:24 0:00 [php] <defunct>
    user_web 21936 0.0 0.0 0 0 ? Z 17:24 0:00 [php] <defunct>
    user_web 21937 0.0 0.1 63492 11164 ? S 17:24 0:00 /usr/local/php5/bin/php
    user_web 21938 0.0 0.1 64528 12452 ? S 17:24 0:00 /usr/local/php5/bin/php
    Quelqu'un sait d'où cela peu venir ?

    Merci

  4. #4
    Futur Membre du Club
    Profil pro
    Inscrit en
    Août 2007
    Messages
    20
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2007
    Messages : 20
    Points : 8
    Points
    8
    Par défaut
    Je ne l'avais pas encore précisé, voici mon serveur :
    http://www.ovh.com/fr/produits/superplan_ssd.xml

Discussions similaires

  1. Load average élevé
    Par tetzispa dans le forum Administration
    Réponses: 9
    Dernier message: 13/11/2014, 16h41
  2. Load average élevé avec système au repos
    Par dranakan dans le forum Administration système
    Réponses: 6
    Dernier message: 13/01/2012, 16h38
  3. load average élevé + apache gourmant en cpu
    Par netsys dans le forum Apache
    Réponses: 1
    Dernier message: 05/05/2011, 17h06
  4. UNDO_RETENTION très élevé
    Par orafrance dans le forum Oracle
    Réponses: 7
    Dernier message: 05/08/2010, 15h31
  5. J'en perds mon latin (pas très élevé, c'est vrai)
    Par laurentSc dans le forum Général JavaScript
    Réponses: 11
    Dernier message: 15/10/2009, 12h12

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo