posix_fadvise(WILLNEED) makes IO slower?

孤街浪徒 提交于 2020-01-01 09:16:37

问题


On a CentOS 5.5 machine running Linux kernel version 2.6.18-194.26.1.el5, I noticed that posix_fadvise(WILLNEED) makes reading 60K files much slower than just regular IO by almost 200%.

It seems that the actual fadvise call is synchronous, and it also delays scheduling other threads in the application that use the data being read from the files.

Is it possible that the kernel is busy with fetching data from the disks due to the fadvise call, and ends up delaying other scheduled task? It seems contrary to the expected asynchronous prefetch behaviour that we expect from making an fadvise call.

My question is: are there any tunable kernel parameters that could be used to enforce asynchronous behavior for posix_fadvise(WILLNEED)? Like increasing kernel IO threads, page cache?


回答1:


This was just recently asked on LKML. That's just how it's designed. If you need a non-blocking fadvise, do it in another thread.



来源:https://stackoverflow.com/questions/4936520/posix-fadvisewillneed-makes-io-slower

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!