Re: Mysql high cpu usage problem
I have the same problem on this hardware:
AMD Opteron 175 (Dual-Core) 4.096 MB DDR-RAM using
the Linux Kernel: 2.6.14.3-051207a
MySQL version: MySQL - 4.1.10a-log using MyISAM tables.
TOP
Tasks: 215 total, 15 running, 199 sleeping, 0 stopped, 1 zombie
Cpu(s): 66.2% us, 32.6% sy, 0.0% ni, 1.0% id, 0.0% wa, 0.0% hi, 0.2% si
Mem: 4052016k total, 3888184k used, 163832k free, 1956k buffers
Swap: 1953784k total, 0k used, 1953784k free, 2332552k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
23924 mysql 15 0 674m 443m 4504 S 99.9 11.2 491:16.60 mysqld
With the following parameters:
key_buffer = 300M
max_allowed_packet = 1M
table_cache = 512
query_cache_size = 32M
#sort_buffer_size = 16M
query_cache_type = 1
query_cache_limit = 1
net_buffer_length = 16K
#read_buffer_size = 8M
#read_rnd_buffer_size = 8M
#myisam_sort_buffer_size = 16M
#tmp_table_size = 32M
log_slow_queries = /var/lib/mysql/slow.log
long_query_time=8
log-error = /var/lib/mysql/err.log
max_connections = 100
interactive_timeout = 100
wait_timeout = 15
connect_timeout = 10
thread_cache=32
Threads_connected is on average only about 8-50 due to a pconnect().