Speeding up file I/O: mmap() vs. read()

前端 未结 3 800
被撕碎了的回忆
被撕碎了的回忆 2020-12-08 02:26

I have a Linux application that reads 150-200 files (4-10GB) in parallel. Each file is read in turn in small, variably sized blocks, typically less than 2K each.

I c

3条回答
  •  半阙折子戏
    2020-12-08 02:52

    Perhaps using the readahead system call might help, if your program can predict in advance the file fragments it wants to read (but this is only a guess, I could be wrong).

    And I think you should tune your application, and perhaps even your algorithms, to read data in chunk much bigger than a few kilobytes. Can't than be half a megabyte instead?

提交回复
热议问题