我有一个不错的CentOS 6.5专用主机(CentOS 6.5 / E3-1230 3.2Ghz四核+ HT / 16GB /软件RAID 1 SATA II / WD2503ABYX / ext4),默认的CentOS内核和grub中的“elevator = deadline”。
I / O写入操作会导致CPU使用率的巨大上升。 阅读工作正常。 例如,
dd if=/dev/zero of=test bs=1048576 count=2048
导致主机的CPU利用率超过3或4。在正常操作下,它仍然在0.40以下,但是当I / O操作更加激烈的时候,一切都会停下来。
在这些ddtesting中, mpstat 1显示io等待 20-25%。
这是磁盘布局:
Disk /dev/sda: 251.1 GB, 251059544064 bytes 255 heads, 63 sectors/track, 30522 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x000c6673 Device Boot Start End Blocks Id System /dev/sda1 * 1 26 204800 fd Linux raid autodetect Partition 1 does not end on cylinder boundary. /dev/sda2 26 548 4194304 fd Linux raid autodetect Partition 2 does not end on cylinder boundary. /dev/sda3 548 30523 240775168 fd Linux raid autodetect Disk /dev/sdb: 251.1 GB, 251059544064 bytes 255 heads, 63 sectors/track, 30522 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00095c99 Device Boot Start End Blocks Id System /dev/sdb1 * 1 26 204800 fd Linux raid autodetect Partition 1 does not end on cylinder boundary. /dev/sdb2 26 548 4194304 fd Linux raid autodetect Partition 2 does not end on cylinder boundary. /dev/sdb3 548 30523 240775168 fd Linux raid autodetect Disk /dev/md2: 246.6 GB, 246552588288 bytes 2 heads, 4 sectors/track, 60193503 cylinders Units = cylinders of 8 * 512 = 4096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/md1: 4293 MB, 4293910528 bytes 2 heads, 4 sectors/track, 1048318 cylinders Units = cylinders of 8 * 512 = 4096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/mapper/vg_main-LogVol00: 246.5 GB, 246549577728 bytes 255 heads, 63 sectors/track, 29974 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Disk /dev/md0: 209 MB, 209702912 bytes 2 heads, 4 sectors/track, 51197 cylinders Units = cylinders of 8 * 512 = 4096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000
这个问题(高CPU使用率)去年12月下旬开始发生,这使我相信它是软件相关的(磁盘susbsystem已经由在DC的人检查)。
我应该运行哪些testing来尝试隔离问题?
PS:我不是在寻找性能最大化的提示。 服务器未充分利用。 我只是想减less磁盘写入时的CPU负载。
更新:重新构造问题以更好地描述问题。
更新:find解决scheme当我遇到这个post时,我终于发现了什么问题。
root> modprobe vhost_net root> echo vhost_net > /etc/modules
由于某些原因,virtio接口之前没有加载驱动程序。 现在一切都好。
在CentOS上, dirty_ratio设置为20%。
这意味着写一个文件做
dd if=/dev/zero of=test bs=1048576 count=2048
实际上将数据写入内存作为回写(高达3.2GB),并不实际写入磁盘。
它在虚拟机上较慢(但不是一个现实的性能基准),因为你可能已经给虚拟机本身指定了一个更低的内存分配(比如说2G),这会导致dirty_writeback只提供dirty_writeback的回写,然后强制内容到磁盘。
如果您运行该命令,然后运行sync ,您会发现同步需要很长时间才能返回。
你需要运行你的命令来做下面的事情,以便更好地理解你的实际吞吐量。
dd if=/dev/zero of=test oflag=sync bs=1048576 count=2048