Mysql编译安装参数优化

http://www.javaeye.com/topic/123197

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

2. -pgcc  1%
   CFLAGS="-O3 -mpentiumpro -mstack-align-double" CXX=gcc \
     CXXFLAGS="-O3 -mpentiumpro -mstack-align-double \
     -felide-constructors -fno-exceptions -fno-rtti"
如果是Inter处理器,使用pgcc提高1%性能

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. CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors "  
  2.     ./configure \  
  3.        --prefix=/usr/local/mysql --enable-assembler \  
  4.        --with-mysqld-ldflags=-all-static  
  5.        --with-client-ldflags=-all-static  
  6.        --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock  
  7.      --with-charset=utf8  
  8.        --with-collation=utf8_general_ci  
  9.        --with-extra-charsets=all 
32bits:

CFLAGS="-O6" CXX=pgcc CXXFLAGS="-O6 -felide-constructors  -fno-exceptions -fno-rtti"

64bits:

 

CFLAGS="-O6 -funroll-loops -Wall -W -mtune=nocona -mcpu=nocona -march=nocona -mfpmath=sse -pipe -fomit-frame-pointer -msse2 -mmmx -m64 -march=x86-64" CXXFLAGS="-O6 -funroll-loops -Wall -W -mtune=nocona -mcpu=nocona -march=nocona -mfpmath=sse -pipe -fomit-frame-pointer -msse2 -mmmx -m64 -march=x86-64" CXX=pgcc CFLAGS="-DDBUG_OFF -O6 -funroll-loops -Wall -W -mtune=nocona -mcpu=nocona -march=nocona -mfpmath=sse -pipe -fomit-frame-pointer -msse2 -mmmx -m64 -march=x86-64" CXXFLAGS="-DDBUG_OFF -O6 -funroll-loops -Wall -W -mtune=nocona -mcpu=nocona -march=nocona -mfpmath=sse -pipe -fomit-frame-pointer -msse2 -mmmx -m64 -march=x86-64 -fno-implicit-templates -fno-exceptions -fno-rtti"

 

 

5.0编译参数:

./configure '--prefix=/opt/mysql' '--with-unix-socket-path=/tmp/mysql.sock' '--localstatedir=/opt/mysql/data' '--with-mysqld-user=mysql' '--without-isam' '--without-innodb' '--with-big-tables' '--with-charset=utf8' '--with-extra-charsets=all' '--with-pthread' '--enable-thread-safe-client' '--enable-assembler'  '--with-archive-storage-engine' '--with-client-ldflags=-all-static' '--with-readline' '--enable-local-infile'

5.1编译参数:

./configure '--prefix=/opt/mysql' '--with-unix-socket-path=/tmp/mysql.sock' '--localstatedir=/opt/mysql/data' '--with-mysqld-user=mysql' '--without-ndb-debug' '--with-big-tables' '--with-charset=utf8' '--with-extra-charsets=all' '--with-pthread' '--enable-thread-safe-client' '--enable-assembler'  '--with-archive-storage-engine' '--with-client-ldflags=-all-static' '--with-readline' '--enable-local-infile'

 

注意:

Linux-x86上使用gcc编 译而不用帧指针(-fomit-frame-pointer or -fomit-frame-pointer -ffixed-ebp),可以使mysqld1-4%

 

你可能感兴趣的:(Mysql编译安装参数优化)