How to tune my Mysql server ?

How to tune my Mysql server ?

am 03.07.2009 16:37:43 von Blog Tieng Viet

--0-860578983-1246631863=:77255
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

Dear all,
=A0
I am running mysql server sharing with apache web server in a box of freebs=
d 6.4. Hardware spec is roughly as bellow:
CPU: Xeon 3.06GHz x 2
Mem: 4GB
=A0
The version of Mysql is 5.1.17_beta,=A0a pre-complied binary package for Fr=
eeBSD.
=A0
Recently the apache request raises=A0quickly, sometime up to 250~300 reques=
ts.
As a result, mysql response so slowly and sometime encounter errors of over=
memory or crash tables.
=A0
So I try to change my.cnf to make some memory related parameters go up to t=
wice, but MySQL take 80~90% CPU power. The parameters of my.cnf before and =
after changing are flowing (the value commented by # is before)
=A0
[mysqld]
port  =3D 3306
socket  =3D /tmp/mysql.sock
skip-locking
key_buffer =3D 640M #384M
max_allowed_packet =3D 2M #1M
table_cache =3D 1028 #512
sort_buffer_size =3D 4M #2M
read_buffer_size =3D 4M #2M
read_rnd_buffer_size =3D 16M #8M
myisam_sort_buffer_size =3D128M # 64M
thread_cache_size =3D 16# 8
query_cache_size =3D 64M#32M
# Try number of CPU's*2 for thread_concurrency
thread_concurrency =3D 8
wait_timeout=3D20
thread_cache =3D 240#120
max_connection =3D 350
log-slow-queries =3D /usr/local/mysql/mysql-slow.log
long_query_time=3D2
=A0
I would like to receive an advice for changing parameters.
=A0
Best regards.
=A0
Nhat HV
=A0
 
--0-860578983-1246631863=:77255--