1

Please help me. My server is impossible to reach because of high CPU usage. mysqld takes all the CPU. show processlist; shows no queries at most of the time. I tried everything in 3 days but problem still exist. Note if I stop apache mysqld cpu usage gets low

Server is VPS with two 3Ghz cores & 8GB RAM

my.cnf conf: (I tried couple of different settings but nothing helps)

[client]
port        = 3306
socket      = /var/run/mysqld/mysqld.sock

[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice        = 0
syslog

[mysqld]
myisam_use_mmap=1
query_cache_type = 1
join_buffer_size=1M
read_rnd_buffer_size=1M
tmp_table_size=25M
max_heap_table_size=25M
table_open_cache = 7500
open_files_limit=30000
key_buffer_size = 800M
myisam_sort_buffer_size = 256M
innodb_file_per_table=1
innodb_buffer_pool_size = 2G
innodb_log_file_size = 64M
innodb_log_buffer_size = 8M

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-messages-dir = /usr/share/mysql
skip-external-locking
key_buffer      = 16M
max_allowed_packet  = 16M
thread_stack        = 192K
thread_cache_size       = 25
myisam-recover         = BACKUP
max_connections        = 500
query_cache_limit   = 2M
query_cache_size        = 75M
general-log-file        = /var/log/mysql/mysql.log
general-log             = 1
log_error = /var/log/mysql/error.log
log_slow_queries    = /var/log/mysql/mysql-slow.log
long_query_time = 2
expire_logs_days    = 10
max_binlog_size         = 100M

[mysqldump]
quick
quote-names
max_allowed_packet  = 10M

[mysql]
#no-auto-rehash
[isamchk]
key_buffer      = 16M

!includedir /etc/mysql/conf.d/

Right before problem start I saw in mysql error.log that several tables were crashed..I repaired & optimized them but problem still exist. This morning the server was working normally for 15 minutes but then CPU went 100% again..I suspect hack attack but apache access log shows only few root login attempts

Edit iostat output:

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
vda             269.25      2533.24        65.85     236529       6148
vdb               3.56        15.46         0.00       1443          0
vdc               1.81         7.24         0.00        676          0
Deyan Vitanov
  • 695
  • 5
  • 18

0 Answers0