Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a web server with MySQL and apache2. Server running a blog engine and normally it works fine. Yesterday (this is the second time) MySQL takes high CPU usage (790%) and the server hangs. The only thing I can do is restart MySQL process. Normally I have 500/600 users connected at the same time. I hope I wan not under "attack", because this behaviour happens only 2 times in 10 days. Btw, could someone take a look at my config to check if something is wrong configured?

This is the MySQLTuner output:

    -------- General Statistics --------------------------------------------------
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.5.31-1~dotdeb.0
[OK] Operating on 64-bit architecture

-------- Storage Engine Statistics -------------------------------------------
[--] Status: -Archive -BDB -Federated +InnoDB -ISAM -NDBCluster 
[--] Data in MyISAM tables: 247M (Tables: 63)
[--] Data in PERFORMANCE_SCHEMA tables: 0B (Tables: 17)
[!!] InnoDB is enabled but isn't being used
[!!] Total fragmented tables: 8

-------- Performance Metrics -------------------------------------------------
[--] Up for: 9h 11m 15s (738K q [22.326 qps], 72K conn, TX: 3B, RX: 122M)
[--] Reads / Writes: 56% / 44%
[--] Total buffers: 192.0M global + 2.7M per thread (151 max threads)
[OK] Maximum possible memory usage: 597.8M (7% of installed RAM)
[OK] Slow queries: 0% (476/738K)
[OK] Highest usage of available connections: 49% (74/151)
[OK] Key buffer size / total MyISAM indexes: 16.0M/107.5M
[OK] Key buffer hit rate: 99.7% (8B cached / 20M reads)
[OK] Query cache efficiency: 52.2% (226K cached / 434K selects)
[!!] Query cache prunes per day: 78693
[OK] Sorts requiring temporary tables: 0% (31 temp sorts / 81K sorts)
[!!] Temporary tables created on disk: 49% (76K on disk / 153K total)
[OK] Thread cache hit rate: 94% (3K created / 72K connections)
[OK] Table cache hit rate: 43% (265 open / 604 opened)
[OK] Open file limit used: 32% (335/1K)
[OK] Table locks acquired immediately: 99% (472K immediate / 476K locks)

And this is the my.cnf file:

[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
# lc-message-dir is unknown to MySQL 5.1
#lc-messages-dir        = /usr/share/mysql
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              = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 16M
#
# * 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
#
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# Here you can see queries with especially long duration
#slow_query_log = 1
#slow_query_log_file = /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

[mysqldump]
quick
quote-names
max_allowed_packet      = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
key_buffer              = 16M

please, could someone help me to understand if there's something wrong in configuration?

Mnay Thanks Lucas

share|improve this question
    
Check show processlist; when it's happening? –  Shane Madden Oct 12 '13 at 7:57
    
Yep, next time will happen I'll perform the following command: SHOW FULL PROCESSLIST; In the mean time, Is there any fix to the config I need to apply to improve stability? –  Lucas Rey Oct 12 '13 at 8:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.