I’m running MYSQL on a Linux box using basically the my-medium.cnf file. The machine has 1GB of RAM. After MYSQL has been running for a day or so, it starts to use very much memory.
Here is top:
top - 00:52:44 up 67 days, 57 min, 3 users, load average: 0.07, 1.19, 2.39
Tasks: 95 total, 1 running, 94 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0% us, 0.0% sy, 0.0% ni, 99.7% id, 0.3% wa, 0.0% hi, 0.0% si
Mem: 1034084k total, 666440k used, 367644k free, 29476k buffers
Swap: 2096472k total, 463748k used, 1632724k free, 64872k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
24782 mysql 15 0 750m 401m 2476 S 0.0 39.7 37:53.80 mysqld
24820 joeo 24 0 600m 33m 1744 S 0.0 3.3 1:00.73 java
24558 root 16 0 8624 2688 1084 S 0.0 0.3 0:59.94 ddclient
30880 nobody 15 0 9920 1832 1272 S 0.0 0.2 0:00.87 httpd
30441 nobody 15 0 10072 1820 1256 S 0.0 0.2 0:01.09 httpd
24082 nobody 15 0 9920 1808 1256 S 0.0 0.2 0:01.06 httpd
30882 nobody 15 0 9832 1784 1228 S 0.0 0.2 0:01.00 httpd
Earlier today, it was using 1.6GB of VIRT space.
Sometimes, during usage, the machine will start to swap so much, that is is un-usable. Usually after a long period of swapping the memory drops back down to around 750MB as it is now.
Any ideas?
Here is my /etc/my.cnf file:
[mysqld]
datadir=/usr/mysql_data
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
thread_cache_size = 8
thread_concurrency = 2
query_cache_size = 8M
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
Remove the next comment character if you are not familiar with SQL
#safe-updates
[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
Thanks for any ideas!