mysql(mariadb)调优和性能测试器

时间:2015-05-17 20:14:08

标签: mysql performance benchmarking mariadb

我真的不知道如何通过编辑my.cnf配置文件来为我的mysql(mariadb)服务器提供最佳性能。我根据示例my-huge.ini更改了值。我认为这不是我服务器的最佳选择。

配置:

  • 2x Intel Xeon CPU 3.00GHz(+超线程)
  • 4GB RAM
  • 2x scsi hdd 300gb(镜像)

我更喜欢MyISAM,因为我的应用程序可以达到最佳性能。 我的服务器基于运行mysql所以我真的想让它变好:) 查询统计信息:65%选择,30%更新

有人可以建议我一个非常好的配置吗? 有一种方法或软件可以从我的服务器制作基准,并建议我需要更改哪种选项?

#
# The MySQL database server configuration file.
#
# You can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
# 
# One can use all long options that the program supports.
# Run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

# This will be passed to all mysql clients
# It has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port        = 3306
socket      = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram

# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket      = /var/run/mysqld/mysqld.sock
nice        = 0

[mysqld]
#
# * Basic Settings
#
user        = mysql
pid-file    = /var/run/mysqld/mysqld.pid
socket      = /var/run/mysqld/mysqld.sock
port        = 3306
basedir     = /usr
datadir     = /var/lib/mysql
tmpdir      = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking

key_buffer_size     = 384M
max_allowed_packet   = 1M
table_open_cache     = 512
sort_buffer_size     = 2M
read_buffer_size     = 2M
read_rnd_buffer_size     = 8M
myisam_sort_buffer_size  = 64M
thread_cache_size    = 8
query_cache_size     = 32M
thread_concurrency   = 4

# Error log - should be very few entries.
log_error = /var/log/mysql/error.log

# Here you can see queries with especially long duration
#slow_query_log_file = /var/log/mysql/mysql-slow.log
#slow_query_log      = 1
#long_query_time = 2
#log_queries_not_using_indexes


# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
#       other settings you may need to change.
#server-id      = 1
#log_bin            = /var/log/mysql/mysql-bin.log
expire_logs_days    = 10
max_binlog_size         = 100M
#binlog_do_db       = include_database_name
#binlog_ignore_db   = include_database_name

[mysqldump]
quick
max_allowed_packet   = 16M

[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates

[myisamchk]
key_buffer_size      = 256M
sort_buffer_size     = 256M
read_buffer  = 2M
write_buffer     = 2M

[mysqlhotcopy]
interactive-timeout

[isamchk]
key_buffer      = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

0 个答案:

没有答案