Interleaved parallel file read slower than sequential read?

前端 未结 4 893
逝去的感伤
逝去的感伤 2021-01-17 17:25

I have implemented a small IO class, which can read from multiple and same files on different disks (e.g two hard disks containing the same file). In sequential case, both d

相关标签:
4条回答
  • 2021-01-17 18:08

    Maybe http://stxxl.sourceforge.net/ might be of any interest for you, too.

    0 讨论(0)
  • 2021-01-17 18:12

    As you said, a sequential read on a disk is much faster than a read-skip-read-skip pattern. Hard disks are capable of high bandwidth when reading sequentially, but the seek time (latency) is expensive.

    Instead of storing a copy of the file in each disk, try storing block i of the file on disk i (mod 2). This way you can read from both disks sequentially and recombine the result in memory.

    0 讨论(0)
  • 2021-01-17 18:17

    If you are sure that you performing no more than one read per disk (otherwise you will have many disk misses), you still create contention on other parts in the computer - the bus, the raid controller (if exists) and so on.

    0 讨论(0)
  • 2021-01-17 18:30

    If you want to do a parallel read, break the read into two sequential reads. Find the halfway point and read the first half from the first file and the second half from the second file.

    0 讨论(0)
提交回复
热议问题