如何在64位CentOS机器上编译MySQL 5.1以获得高性能?
我希望通过创建针对 64 位 CentOS 和 InnoDB 定制的 MySQL 自定义构建,来实现比现有构建更高的性能。
但是,我不知道从哪里开始。请有人为我提供完成此任务必须采取的步骤列表吗?
I hope to achieve improved performance over the stock builds by creating a custom build of MySQL, tailored for 64-bit CentOS and InnoDB.
However, I have no idea where to begin here. Would someone please be so kind as to provide me with a list of the steps I must take in order to accomplish this task?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
<代码>./配置&&制作&&进行安装
./configure && make && make install
要做的事情:重新评估您的需求!
老实说,编译自己的 DBMS 非常有男子气概,但对于生产环境来说,这将变成一场噩梦!
things to do: re-evaluate your requirements!
Honestly, compiling your own DBMS is very macho and all, but for a production environment this will turn into a nightmare!
不要这样做。如果不能正常工作,再高性能的数据库也是没有用的,MySQL/Sun 版本已经过充分测试。
你的构建不是。
无论如何,我无法想象您会获得比 Sun 更高的性能。他们为您的平台正确编译代码;对二进制文件进行一系列自动测试和冒烟测试,并在发布它们之前尝试在实际应用程序中运行它。
您可能会通过改进自己的代码而不是尝试改进 Sun 的构建来获得更多的性能提升。而且它带来的风险也较小,因为您不会冒数据库行为发生重大回归的风险。
如果您遇到性能问题,最好将时间花在改进自己的代码和进行测试上。开发人员时间是非常非常昂贵的资源!
Don't do it. A database with high performance is no use if it doesn't work correctly, the MySQL / Sun builds are WELL TESTED.
Your build is not.
I can't imagine you getting a significant amount more performance than Sun anyway. They compile the code correctly for your platform; the subject the binaries to a barrage of auto-tests and smoke tests, as well as trying running it with real applications BEFORE they release them.
You will probably get more performance increases from IMPROVING YOUR OWN CODE rather than trying to improve on Sun's builds. And it will carry less risk, because you won't be risking major regressions in database behaviour.
If you have performance problems, your time is best spent improving your own code and doing testing. Developer time is a very, very expensive resource!
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-mysqld-ldflags=-all -static
使用3级编译器优化(可能会创建不可移植的二进制文件),省略构造函数(这在mysql手册中提到),所有静态要快得多。
CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti" ./configure --prefix=/usr/local/mysql --with-mysqld-ldflags=-all-static
Use level 3 compiler optimizations (which may create non-portable binaries), elide constructors (this is mentioned in the mysql manual), all static is much faster.