posix_fadvise(WILLNEED)使IO更慢? [英] posix_fadvise(WILLNEED) makes IO slower?

查看:247
本文介绍了posix_fadvise(WILLNEED)使IO更慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在运行Linux内核版本2.6.18-194.26.1.el5的CentOS 5.5机器上,我注意到posix_fadvise(WILLNEED)使读取60K文件的速度比普通IO慢了近200%。


$ b

看起来实际的fadvise调用是同步的,它也延迟了在应用程序中使用从文件中读取数据的其他线程的计划。



是否有可能内核忙于从磁盘中获取数据,因为调用时间过长,最终导致其他计划任务延迟?我们的问题是:是否有任何可调的内核参数可用于强制执行异步操作行为posix_fadvise(WILLNEED)?像增加内核IO线程,页面缓存?

解决方案

这只是最近问LKML 。这就是它的设计。如果你需要一个非阻塞的 fadvise ,在另一个线程中执行。


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?

解决方案

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.

这篇关于posix_fadvise(WILLNEED)使IO更慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆