2012-06-20 24 views
2

我有問題。freebsd/mysql 5.5高I/O使用率

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

當我在看iostat -d 2時,我看到高磁盤I/O 20 30 mb/s的寫入,但是這並沒有在實際的磁盤增長中轉化,據我所知可以從監控df中看到。

我看着「頂部」,並擊中了m參數來切換並查看哪個進程導致此磁盤活動,並顯示它是mysql服務器。

我不知道從哪裏開始,因爲這對我來說有點令人費解,爲什麼這個高磁盤寫入實際上並沒有在磁盤使用量被修改的情況下進行轉換。

你能否給我一個提示去正確的方向?

我的硬件:雙四核Xeon處理器/ 4×120 GB SSD在RAID10/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 

回答

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 

所以我的猜測是,你沒有看到在所有的寫,而是讀。

看到他們seperately你需要使用-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 /秒爲千字節每讀秒和kw/s是每秒寫入的千字節數。