多次磁盘读写操作会造成瓶颈吗?

发布于 2024-11-02 19:40:59 字数 319 浏览 4 评论 0原文

我做了很多工作,同时从 30 多个进程(通过安装在 NFS 上的 4 个节点)访问一个文件,并且想知道除了带宽瓶颈之外,打开同一文件的连接数较少是否还有优势。具体来说...

这两种访问文件的方式是否存在速度差异:

  1. 1 个文件由 5 个单独的进程访问(仅读取)

  2. 5 个单独的文件(原始大小的 1/5)由 5 个单独的进程访问(仅限阅读)

另外...

即使磁盘带宽没有达到最大,是否存在与打开太多文件连接相关的瓶颈?

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 not maxed out, is there a bottleneck associated with having too many file connections open?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

带上头具痛哭 2024-11-09 19:40:59

多个进程对同一文件的并发访问意味着锁定和序列化操作,至少在某种程度上是这样。在网络文件系统上,任何操作都会产生显着的延迟。虽然您的带宽使用情况不会有太大不同,但所涉及的延迟会显着降低性能。

如果您可以避免通过网络并发访问同一文件,那么如果性能很重要,您可能应该这样做。

顺便说一句,NFS 和大多数其他网络文件系统长期以来都存在锁定和并发访问问题,即使应用程序执行显式锁定也是如此 - 通常的结果是某种形式的数据损坏。

如果可以的话,考虑切换到适当的基于网络的协议,其中多个进程将数据提供给写入输出文件的中央日志记录/记录服务器,而不涉及 NFS 或其任何朋友...

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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文