在具有64GB内存的系统上,Linux缓冲区运行完整,同时使用dd复制到dev和null,直到手动drop_caches停止

我正在运行一个Linux软件突袭10的服务器。这是一个双CPU系统与64GB RAM。 与每个CPU相关的2x16GB调光器。 我想用dd来备份kvm虚拟机,并且遇到严重的io问题。 首先我认为是与raid有关,但这是linux内存pipe理的一个问题。 这里是一个例子:

  1. 内存很好: http : //i.stack.imgur.com/NbL60.jpg
  2. 我开始dd: http : //i.stack.imgur.com/kEPN2.jpg
  3. 你也看到nmon显示磁盘访问: http : //i.stack.imgur.com/Njcf5.jpg
  4. 过了一会儿,“缓冲区”很大,复制进度停止http://i.stack.imgur.com/HCefI.jpg
  5. 这里是meminfo: http : //i.stack.imgur.com/KR0CE.jpg
  6. 这里的dd输出: http : //i.stack.imgur.com/BHjnR.jpg
  7. 我可以手动解决临时的问题,强制删除caching:“sync; echo 3> / proc / sys / vm / drop_caches”
  8. 通话需要几秒钟,然后立即dd速度达到正常水平。 当然,我可以每分钟都有一个cronjob或者这样的事情,但那不是一个真正的解决scheme。 http://i.stack.imgur.com/zIDRz.jpg http://i.stack.imgur.com/fO8NV.jpg

有没有人有解决scheme或configuration提示? 这里也是我的sysctl,但所有的值都是centos默认值: http : //i.stack.imgur.com/ZQBNG.jpg

EDIT1

我做了另一个testing,而不是/ dev / null dd到磁盘。 这一次也在一个没有光伏的命令。 所以它只有一个过程。 dd if=/dev/vg_main_vms/AppServer_System of=AppServer_System bs=4M

  1. 它从没有写入的阅读开始(目标不在同一个磁盘上) http://i.stack.imgur.com/jJg5x.jpg
  2. 过了一段时间,写作开始,阅读速度减慢http://i.stack.imgur.com/lcgW6.jpg
  3. 之后写一个唯一的时间来: http : //i.stack.imgur.com/5FhG4.jpg
  4. 现在开始的主要问题。 复制过程放慢到1mbs以下,没有任何事情发生: http ://i.stack.imgur.com/YfCXc.jpg
  5. dd进程现在需要100%cpu时间(1核心) http://i.stack.imgur.com/IZn1N.jpg
  6. 再次,我可以手动解决暂时的问题,并强制删除caching: sync; echo 3 > /proc/sys/vm/drop_caches sync; echo 3 > /proc/sys/vm/drop_caches 。 之后,同样的游戏再次启动…

EDIT2

对于本地DD,我可以用参数iflag = direct和oflag = direct解决。 但是这不是通用的解决scheme,因为还有其他的文件访问方式,比如将文件复制到vm的本地samba共享中,而且我不能使用这些参数。 必须调整系统文件caching规则,因为不能正常复制大文件而没有这些问题。

只是一个疯狂的猜测。 你的问题可能是大的脏页面冲洗。 尝试设置/etc/sysctl.conf,如下所示:

 # vm.dirty_background_ratio contains 10, which is a percentage of total system memory, the # number of pages at which the pdflush background writeback daemon will start writing out # dirty data. However, for fast RAID based disk system this may cause large flushes of dirty # memory pages. If you increase this value from 10 to 20 (a large value) will result into # less frequent flushes: vm.dirty_background_ratio = 1 # The value 40 is a percentage of total system memory, the number of pages at which a process # which is generating disk writes will itself start writing out dirty data. This is nothing # but the ratio at which dirty pages created by application disk writes will be flushed out # to disk. A value of 40 mean that data will be written into system memory until the file # system cache has a size of 40% of the server's RAM. So if you've 12GB ram, data will be # written into system memory until the file system cache has a size of 4.8G. You change the # dirty ratio as follows: vm.dirty_ratio = 1 

然后执行sysctl -p重新加载,再次删除caching( echo 3 > /proc/sys/vm/drop_caches )。