Saturday, March 31, 2007

mySQL slow on MacOS, most of CPU time is %nice


Most of the time mySQL appears "blue" in Activity Monitor, meaning that CPU time is mostly spent as "nice".

















This happens with mysql-standard-4.1.13-apple-darwin8.1.0-powerpc (the one that comes with OS X 10.4.9), and same with mysql-5.1.16-beta-osx10.4-powerpc

First I thought that I'm running "wrong queries" (generated by Cubulus, work in progress), but today it happened during standard operations ex: "alter table fact drop column dim_4;" (MyISAM table with 2 500 000 rows)

Computer is an iMac G5 1.8 Ghz with 1.5 Gb memory (table fits in memory, there is no waiting due to disk). At the time of screen capture there was no other task doing anything relevant, except for Activity Monitor. There was no other query for mySQL.

Configuration /etc/my.cnf file is:
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 256M
max_allowed_packet = 1M
table_cache = 1024
sort_buffer_size = 1M
read_buffer_size = 4M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache = 8
query_cache_size= 0M
#lowered in order to minimize OS X context switching overhead
thread_concurrency = 2

#OS X recommended setting
skip-thread-priority

skip-networking

log-bin

server-id = 1

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[isamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M

[myisamchk]
key_buffer = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

No comments: