简体   繁体   English

在更新的Linux内核上,同步IO的速度令人难以置信

[英]Sync IO is unbelievably slower on newer Linux kernel

I just find that sync IO is getting much much slower on newer kernels. 我只是发现同步IO在较新的内核上变得越来越慢。 I have tried the following commands on CentoOs(2.6), Fedora20(3.11), Ubuntu12(3.2) . 我已经在CentoOs(2.6),Fedora20(3.11),Ubuntu12(3.2)上尝试了以下命令。

echo 0 > test
dd if=/dev/zero of=test bs=1024 count=200 oflag=dsync

The speed for 2.6 is about 1MB/s and only around 25kB/s for new kernels. 2.6的速度约为1MB / s,而新内核的速度仅为25kB / s。

I have a CFD code which calls sync() in a C function. 我有一个CFD代码,该代码在C函数中调用sync() Usually the code runs very fast on old kernels, but now it is much slower on newer OS. 通常,代码在旧内核上运行速度非常快,但现在在较新的操作系统上运行速度要慢得多。 I am really curious what the Linux developers have done to sync() . 我真的很好奇Linux开发人员做了什么sync() The other possible reason is not on kernel version, but the file system used by different OS. 另一个可能的原因不是内核版本,而是不同操作系统使用的文件系统。

At this point my code needs sync() anyway, so is there anything I can tune like ioctl() to speed it up? 在这一点上,我的代码仍然需要sync() ,所以有什么可以像ioctl()一样进行调整以加快速度的吗?

Any comment is truly appreciated. 任何评论是真正的赞赏。

The apparent performance of sync() is greatly affected by the amount of memory installed in the system, the usage pattern of disk i/o (including the drive's caches, DMA controllers, etc.), and the speed of the disk drives. sync()的明显性能受系统中安装的内存量,磁盘I / O(包括驱动器的缓存,DMA控制器等)的使用模式以及磁盘驱动器的速度的影响很大。

Without rigorously controlling for all these variables, comparing one system to another is reasonably meaningless when you think you are changing only the kernel. 如果没有严格控制所有这些变量,则当您认为仅更改内核时,将一个系统与另一个系统进行比较就毫无意义。

The effect of newer hardware seeming to make things slower makes sense. 较新的硬件的作用似乎使事情变慢了。 Instead of the kernel flushing out pending writes when there is a 250 MB backlog (because the system only has 2 GB of RAM), it can now defer it to a 16 GB backlog because the newer system has 64 GB of RAM. 当存在250 MB的积压时(因为系统只有2 GB的RAM),内核现在可以将其推迟到16 GB的积压,因为较新的系统具有64 GB的RAM,而不是内核清除待处理的写操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM