【问题标题】:freebsd / mysql 5.5 high i/o usagefreebsd / mysql 5.5 高 i/o 使用率
【发布时间】:2012-06-22 04:25:32
【问题描述】:

我有问题。

我在 freebsd8 服务器上使用 mysql5.5,带有 php 5.3.13 -fpm 和 nginx。

当我查看 iostat -d 2 时,我看到写入中的磁盘 i/o 20 30 mb/s 很高,但是从监控 df 中可以看出,这并不能转化为实际的磁盘增长。

我查看了“top”,然后点击 m 参数来切换,看看是哪个进程导致了这个磁盘活动,它显示它是 mysql 服务器。

我不知道从哪里开始,因为这让我有点困惑为什么这种高磁盘写入实际上并没有转化为磁盘使用被修改。

你能给我一个提示,让我朝着正确的方向前进吗?

我的硬件:双四核至强/raid10 中的 4 x 120 gb ssd / 16 gb ram

下面是我的“my.cnf”文件

    [mysqld]
datadir=/var/db/mysql
socket=/tmp/mysql.sock
skip-external-locking
skip-name-resolve
query_cache_limit=256M
query_cache_size=256M
query_cache_type=1
ft_min_word_len=3
max_user_connections=200
max_connections=200
interactive_timeout=10
wait_timeout=30
connect_timeout=10
thread_cache_size=128
long_query_time=5
key_buffer_size=1024M
join_buffer=2M
max_allowed_packet=16M
table_cache=32384
sort_buffer_size=4M
read_buffer_size=4M
max_connect_errors=10
thread_concurrency=8
myisam_sort_buffer_size=64M
low_priority_updates=1
concurrent_insert=2
max_heap_table_size=128M
tmp_table_size=128M
slow_query_log=1
slow_query_log_file=/var/db/mysql/razor-slow-log-by-katmai.log
long_query_time=1
log-queries-not-using-indexes
server-id=1
local-infile=0
innodb_open_files=131072
innodb_buffer_pool_size=8192M
#new options
#innodb_log_file_size=256M
#innodb_log_buffer_size=4M
#innodb_flush_log_at_trx_commit=2
#innodb_thread_concurrency=8
############################
#for recovery
#innodb_force_recovery=4
#innodb_file_per_table=

#[mysql.server]
#user=mysql
#basedir=/var/lib

[safe_mysqld]
err-log=/var/db/mysql/razor-mysqld.log
pid-file=/var/db/mysql/mysql.pid
open_files_limit=131072

#[mysqldump]
#quick
#max_allowed_packet=16M

[mysql]
no-auto-rehash

[isamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[mysqlhotcopy]
interactive-timeout

【问题讨论】:

    标签: mysql io freebsd disk


    【解决方案1】:

    标准的iostat 显示显示结合读取和写入:

    foobox:~> iostat -d 2
              ada0             ada1              cd0              cd1 
    KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s   KB/t tps  MB/s 
    27.52   5  0.15  14.82   2  0.03   0.00   0  0.00   0.00   0  0.00 
    96.00   1  0.14   0.00   0  0.00   0.00   0  0.00   0.00   0  0.00 
    128.00   1  0.19   0.00   0  0.00   0.00   0  0.00   0.00   0  0.00 
    64.00   3  0.19   0.00   0  0.00   0.00   0  0.00   0.00   0  0.00 
    

    所以我猜你根本看不到写入,而是读取。

    要单独查看它们,您需要使用 -x 标志来扩展统计信息:

    foobox:~> iostat -d -x 2
                            extended device statistics  
    device     r/s   w/s    kr/s    kw/s qlen svc_t  %b  
    ada0       1.9   3.6    51.3    98.5    0  37.6   1 
    ada1       0.8   1.3     3.3    28.0    0  12.5   0 
    cd0        0.0   0.0     0.0     0.0    0   0.0   0 
    cd1        0.0   0.0     0.0     0.0    0   0.0   0 
    pass0      0.0   0.0     0.0     0.0    0   0.0   0 
    pass1      0.0   0.0     0.0     0.0    0   0.0   0 
    pass2      0.0   0.0     1.1     0.0    0   0.0   0 
    pass3      0.0   0.0     0.0     0.0    0   0.0   0
    

    有关标头含义的完整概述,请参阅 iostat 手册页,但 kr/s 是每秒读取的千字节数,kw/s 是每秒写入的千字节数。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-08-14
      • 1970-01-01
      • 1970-01-01
      • 2013-10-15
      • 1970-01-01
      • 2019-12-07
      • 2011-10-19
      • 1970-01-01
      相关资源
      最近更新 更多