开发者

Multiple disk read/write operations can cause bottleneck?

I've been doing a lot of work where I concurrently access one file from 30+ processes (via 4 nodes mounted on NFS) and was wondering if, besides the bandwith bottleneck, there is an advantage to having less connections opening the same file. Specifically...

Will there be a speed difference in these two ways a file is accessed:

  1. 1 file accessed by 5 separate processes (ONLY READING)

  2. 5 separate files (1/5 the size of original) accessed by 5 separate processes (ONLY READING)

Also...

Even if the disk bandwidth is开发者_如何学Go not maxed out, is there a bottleneck associated with having too many file connections open?


Concurrent access to the same file by multiple processes implies locking and serialization operations, at least to some degree. On a network filesystem that can insert significant latencies to any operation. While your bandwidth usage will not be all that different, the latencies involved can reduce performance significantly.

If you can avoid concurrent accesses to the same file over the network, you should probably do so if performance matters at all.

By the way, NFS and most other network filesystems have had a long history of issues with locking and concurrent accesses, even when the application performs explicit locking - the usual result being some form of data corruption.

If you can, consider switching to a proper network-based protocol, where multiple processes feed data to a central logging/recording server that writes to your output file, without involving NFS or any of its friends...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜