全部博文(389)
分类: LINUX
2014-06-02 00:39:19
RHEL 6.4(centOs 6.4) jdb2进程占用io过高
某日在检测一系统性能时,发现io性能总是无故被消耗,即使应用程序很空闲,io使用程度也
很高.
使用iotop工具查看io情况.
Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
3584 be/4 mysql 0.00 B/s 0.00 B/s 0.00 % 0.00 % [jbd2/dm-0-8]
1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init
2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd]
1118 be/3 root 0.00 B/s 3.85 K/s 0.00 % 0.00 % auditd
2152 be/4 mysql 0.00 B/s 3.85 K/s 0.00 % 0.00 % mysqld --basedir=/usr/local/Perco~--socket=/var/lib/mysql/mysql.sock
1317 be/4 haldaemo 100.10 K/s 0.00 B/s 0.00 % 0.00 % hald
3584 rt/4 mysql 0.00 B/s 0.00 B/s 0.00 % 0.00 % mysqld --basedir=/usr/local/Perco~--socket=/var/lib/mysql/mysql.sock
11027 rt/4 root 193.22 K/s 0.00 B/s 0.00 % 21.38 % plymouthd --mode=shutdown
1317 be/4 haldaemo 297.56 K/s 0.00 B/s 2.39 % 8.33 % hald
1569 be/4 root 92.75 K/s 0.00 B/s 0.00 % 4.97 % console-kit-daemon --no-daemon
462 be/3 root 30.92 K/s 0.00 B/s 4.21 % 3.08 % udevd -d
1118 be/3 root 0.00 B/s 3.86 K/s 0.00 % 0.00 % auditd
1283 be/4 root 30.92 K/s 0.00 B/s 0.00 % 0.00 % cupsd -C /etc/cups/cupsd.conf
785 be/3 root 81.15 K/s 0.00 B/s 3.96 % 0.00 % udevd -d
2122 be/4 apache 312.19 K/s 0.00 B/s 77.32 % 0.00 % httpd d_usbd]
2123 be/4 apache 312.19 K/s 0.00 B/s 77.66 % 0.00 % httpd
3497 be/4 apache 312.19 K/s 0.00 B/s 78.87 % 0.00 % httpd
376 be/3 root 0.00 B/s 11.05 K/s 0.00 % 2.84 % [jbd2/dm-0-8]
2139 be/4 mysql 0.00 B/s 0.00 B/s 0.00 % 0.22 % mysqld --basedir=/usr/local/Perco~--socket=/var/lib/mysql/mysql.sock
2152 be/4 mysql 0.00 B/s 3.68 K/s 0.00 % 0.00 % [jbd2/dm-0-8]
376 be/3 root 0.00 B/s 0.00 B/s 0.00 % 0.12 % [jbd2/dm-0-8]
2144 be/4 mysql 0.00 B/s 11.67 K/s 0.00 % 0.08 % mysqld --basedir=/usr/local/Perco~--socket=/var/lib/mysql/mysql.sock
2154 be/4 mysql 0.00 B/s 155.62 K/s 0.00 % 0.06 % [jbd2/dm-0-8]
376 be/3 root 0.00 B/s 0.00 B/s 0.00 % 0.04 % [jbd2/dm-0-8]
发现大量jdb2进程占用io资源.jdb2进程是一个文件系统的写journal的进程,写的次数实在太频繁了,通过perf工具查看
系统相关的占用io的调用
Samples: 1K of event 'block:block_rq_issue', Event count (approx.): 1344
+ 58.71% jbd2/dm-0-8 [kernel.kallsyms] [k] child_rip
+ 12.87% flush-253:0 [kernel.kallsyms] [k] _spin_unlock_irqrestore
+ 11.31% flush-253:0 [kernel.kallsyms] [k] child_rip
+ 8.85% mysqld libpthread-2.12.so [.] 0x000000000000ec0d
+ 2.01% jbd2/dm-0-8 [kernel.kallsyms] [k] memset
+ 1.19% mysqld [kernel.kallsyms] [k] _spin_unlock_irqrestore
+ 0.97% kblockd/0 [kernel.kallsyms] [k] child_rip
+ 0.37% kblockd/0 [kernel.kallsyms] [k] _spin_unlock_irqrestore
+ 0.37% flush-253:0 [kernel.kallsyms] [k] scsi_request_fn
+ 0.37% dd [kernel.kallsyms] [k] sha_transform
+ 0.30% ls ld-2.12.so [.] dl_main
+ 0.30% flush-253:0 [kernel.kallsyms] [k] blk_queue_bio+
0.22% who ld-2.12.so [.] memset+
0.22% jbd2/dm-0-8 [kernel.kallsyms] [k] _spin_unlock_irqrestore+
0.22% flush-253:0 [kernel.kallsyms] [k] kmem_cache_alloc
可以看到jbd2/dm-0-8占用了将近60%的io资源。
查询得知此现像是由于bug造成,可以升级或是通过修改文件系统的提交次数来降低.更改 commit=60后的效果
Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s
TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND
1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init
2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd]
3 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [migration/0]
4 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ksoftirqd/0]
5 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [migration/0]
6 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [watchdog/0]
7 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [events/0]
8 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [cgroup]
9 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [khelper]
10 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [netns]
11 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [async/mgr]
12 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [pm]
13 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [sync_supers]
14 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [bdi-default]
15 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kintegrityd/0]
16 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kblockd/0]
17 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kacpid]
18 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kacpi_notify]
19 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kacpi_hotplug]
20 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ata/0]
perf报告也显示io已经不是由jbd2消耗
Samples: 11 of event 'block:block_rq_issue', Event count (approx.): 11
+ 72.73% flush-253:0 [kernel.kallsyms] [k] child_rip
+ 18.18% swapper [kernel.kallsyms] [k] tick_nohz_stop_sched_tick
+ 9.09% kblockd/0 [kernel.kallsyms] [k] child_rip