There is a comparison or performance table of the different uses of FlushFileBuffers and FILE_FLAG_NO_BUFFFERING?

坚强是说给别人听的谎言 提交于 2019-12-12 19:47:49

问题


I'm about to choose using FlushFileBuffers after each write in a file or FILE_FLAG_NO_BUFFFERING each time I need open the same file.

But I did not find any performance comparison table about the use of one or another option. Well, except this advice in MSDN:

If an application is performing multiple writes to disk and also needs to ensure critical data is written to persistent media, the application should use unbuffered I/O instead of frequently calling FlushFileBuffers. To open a file for unbuffered I/O, call the CreateFile function with the FILE_FLAG_NO_BUFFERING and FILE_FLAG_WRITE_THROUGH flags. This prevents the file contents from being cached and flushes the metadata to disk with each write.

So I'm assuming that: for an application that will write and read many times it is better not use FlushFileBuffers. But there is any comparison article, blog, forum post about the use of them? And if the file is being closed after the write? My google-fu did not get anything yet.

来源:https://stackoverflow.com/questions/10564575/there-is-a-comparison-or-performance-table-of-the-different-uses-of-flushfilebuf

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