Elton's Blog

MySQL 编译参数优化

by on 六.23, 2009, under Linux

适当的调整MySQL的编译参数,可以极大的提升MySQL的性能,官方文档说可以提升10-30%的性能。

1. -static 13%
–with-client-ldflags=-all-static
–with-mysqld-ldflags=-all-static
静态链接提高13%性能

2. -pgcc 1%
CFLAGS=”-O3 -mnocona -mstack-align-double” CXX=gcc
CXXFLAGS=”-O3 -mnocona -mstack-align-double
-felide-constructors -fno-exceptions -fno-rtti”
如果是Inter处理器,使用pgcc提高1%性能, 其中-m参数指定你cpu的类型,如果你是Intel Pentium4 支持64位的CPU就试用nocona这个参数,如果你是Intel Core2则使用core2这个参数。详细的cpu支持参数列表在这里

3. Unix Socket 7.5%
–with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
使用unix套接字链接提高7.5%性能,所以在windows下mysql性能肯定不如unix下面

4. –enable-assembler
允许使用汇编模式(优化性能)

1
2
3
4
5
6
7
8
9
10
CFLAGS="-O3 mnocona" CXX=gcc CXXFLAGS="-O3 mnocona -felide-constructors 
         -fno-exceptions -fno-rtti -fomit-frame-pointer -ffixed-ebp"
        ./configure 
           --prefix=/usr/local/mysql --enable-assembler 
           --with-mysqld-ldflags=-all-static
           --with-client-ldflags=-all-static
           --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
           --with-charset=utf8
           --with-collation=utf8_general_ci
           --with-extra-charsets=all




:, ,

27 Comments for this entry

Leave a Reply



Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit my friends!

A few highly recommended friends...