I've been having this problem recently on my dedicated LAMP server. It
pretty much only occurs during high traffic loads. MySQL, for whatever
reason, randomly spawns a high number of threads and completely bogs
down the server. Here's a screenshot of the past week's mysql thread
activity.
http://xinil.net/images/mysql/localh...reads-week.png
Notice the random 200+ spikes?
And here's what the query report looks like. We can see that 'no'
queries are being processed when the mysql thread count is high.
http://xinil.net/images/mysql/localh...eries-week.png
IO Wait also reaches 100%~ when the thread count jumps. So the server
load jumps to 40+, and apache dies as well. If I do nothing, it takes
anywhere from 1 to 3 hours for the server to 'fix' itself. If I
perform a 'service mysqld restart' though, it fixes itself
immediately.
Does anyone have any ideas why this happens? As you can see, the
server is fine sometimes, but during large traffic hours, it randomly
spikes.
Any help is appreciated. Thanks!
Server specs:
Core 2 Duo E6550, 2gb ram
my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
max_connections=500
safe-show-database
query-cache-type=1
query_cache_limit=2M
query-cache-size=32M
ft_min_word_len=2
concurrent_insert=2
myisam_sort_buffer_size=64M
key_buffer_size=384M
max_allowed_packet=16M
table_cache=1848
thread_cache_size=8
thread_concurrency=4
low_priority_updates=1
long_query_time=5
log-slow-queries=/home/mysql/slow-query
#log-queries-not-using-indexes
max_heap_table_size=300M
tmp_table_size=300M
sort_buffer_size=4M
read_buffer_size=4M
join_buffer_size=2M
read_rnd_buffer_size=4M
wait_timeout = 120