我应该如何在My.cnf中设置初始MySQL值以获得性能?

我现在正在设置我的新Linux Ubuntu 8.04 LTS服务器,并准备启动.我的应用程序是使用Zend Framework构建的PHP应用程序,并且有一个MySQL重型站点(可能是大多数站点).到目前为止,我只有1台服务器,它是一台完整的LAMP服务器.

我想知道的是,我应该设置这些值(默认显示)以获得最佳性能(请记住,这个服务器也在运行apache和PHP)我的服务器有4 GB Ram.我只从配置文件中剪切了必要的值,以节省大量的混淆.

这里有更多信息:
到目前为止,所有内容都是默认的安装设置(包括数据库表).我期待每秒约100次交易.我不确定我可以投入多少内存,因为服务器本身也托管apache和php,我有1gm内存和4gb burstable(托管在虚拟服务器上).大多数情况下,我的网站将抛出静态值(约会网站),但是,它也将处理来自不同用户的交易(保存,编辑等).

以下是my.cnf文件的一些部分,以及它们各自的值……

任何帮助,或洞察力将非常感激.

# Fine Tuning
key_buffer              = 16M
max_allowed_packet      = 16M
thread_stack            = 128K
thread_cache_size       = 8
#max_connections        = 100
#table_cache            = 64
#thread_concurrency     = 10

# Query Cache Configuration
query_cache_limit       = 1M
query_cache_size        = 16M

# Here you can see queries with especially long duration
log_slow_queries        = /var/log/mysql/mysql-slow.log
long_query_time = 2
log-queries-not-using-indexes

# BerkeleyDB
#
# Using BerkeleyDB is now discouraged as its support will cease in 5.1.12.
skip-bdb

# InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
# You might want to disable InnoDB to shrink the mysqld process by circa 100MB.
#skip-innodb

[isamchk]
key_buffer              = 16M
最佳答案
MySQLTuner

MySQLTuner is a script written in Perl
that will assist you with your MySQL
configuration and make recommendations
for increased performance and
stability. Within seconds, it will
display statistics about your MySQL
installation and the areas where it
can be improved.

It’s key to remember that MySQLTuner
is a script which can assist you with
your server, but it is not the
solution to a badly performing MySQL
server. The best performance gains
come from a thorough review of the
queries sent to the server, and an
evaluation of the MySQL server itself.
A qualified developer in your
application’s programming or scripting
language should be able to work with a
MySQL database administrator to find
improvements for your server. Once the
server and application are optimized
well, you may need to consider
hardware upgrades to the physical
server itself.

转载注明原文:我应该如何在My.cnf中设置初始MySQL值以获得性能? - 代码日志