我的数据库服务器(双四核50 gb内存)存在负载问题
平均负载:4.26,6.78,11.25
这是当前的my.cnf,我能优化吗?
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
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
language = /usr/share/mysql/english
skip-external-locking
key_buffer = 150M
key_buffer_size = 512M
max_allowed_packet = 16M
thread_stack = 128K
thread_cache_size = 128
open-files = 8192
myisam-recover = BACKUP
max_connections = 1000
table_cache = 8096
join_buffer_size = 2M
tmp_table_size = 10G
max_heap_table_size = 10G
innodb_buffer_pool_size = 10G
innodb_additional_mem_pool_size = 128M
innodb_log_file_size = 100M
log-slow-queries = /var/log/mysql/slow.log
sort_buffer_size = 5M
net_buffer_length = 5M
read_buffer_size = 2M
read_rnd_buffer_size = 12M
thread_concurrency = 16
ft_max_word_len = 30
ft_min_word_len = 2
#thread_concurrency = 10
query_cache_limit = 4M
query_cache_size = 512M
该网站约有2000名在线用户。
答案 0 :(得分:0)
我总是从watch "mysqladmin pr -vv"
开始看看哪个陈述是最糟糕的...然后你应该知道要调整哪个变量......大部分时间它都是缺失的索引。
答案 1 :(得分:0)
使用 mytop 和 mysqltuner 分析使用mysql资源(RAM和CPU)。
太多启用选项以记录慢查询:
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 3
查看这篇关于 ntpd 服务的帖子:
我有专门用于高交易率的服务器:
max_allowed_packet=16M
key_buffer_size=8M
innodb_additional_mem_pool_size=10M
innodb_buffer_pool_size=512M
join_buffer_size=40M
table_open_cache=1024
query_cache_size=40M
table_definition_cache=256
innodb_additional_mem_pool_size=10M
key_buffer_size=16M
max_allowed_packet=32M
max_connections = 300
query_cache_limit = 10M
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 3
问候。