Friday, November 14, 2008
Tune MySQL performance
For a dual-core machine with 2 GB of RAM:
$ cat /etc/mysql/conf.d/performance.cnf
[mysqld]
query_cache_size=32M
max_connections=300
thread_cache_size=80
thread_concurrency=4
key_buffer=128M
sort_buffer_size=1M
read_buffer_size=1M
read_rnd_buffer_size=1M
Especially max_connections is helpful if you have high concurrency and get
$ cat /etc/mysql/conf.d/performance.cnf
[mysqld]
query_cache_size=32M
max_connections=300
thread_cache_size=80
thread_concurrency=4
key_buffer=128M
sort_buffer_size=1M
read_buffer_size=1M
read_rnd_buffer_size=1M
Especially max_connections is helpful if you have high concurrency and get
"Lost connection to server during query" errors.