为什么将文件系统类型从 XFS 更改为 JFS 会提高 mmap 文件写入性能?

发布于 2024-10-25 12:14:30 字数 154 浏览 5 评论 0原文

我一直在尝试不同的文件系统,并比较使用 mmap 时各种文件系统的性能。

令我惊讶的是,更改为 JFS 后写入性能直接翻倍。 我认为写入已完成到页面缓存,因此当写入完成后,应用程序会继续快速运行? linux下真的是同步操作吗?

读取性能略有提高,但不那么显着。

I have been playing around with different filesystems and comparing the performance of the various filesystems when using mmap.

I am suprised that changing to JFS doubled the write performance straight off.
I thought writes were done to the page cache and so when a write is done the app keeps moving on quickly? is it actually a synchronous operation under linux?

A slight increase in read performance, but not as significant.

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

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

发布评论

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

评论(3

宛菡 2024-11-01 12:14:30

写入直接完成到页面缓存,但是第一次写入每个页面时会导致一个小错误,将该页面标记为脏。此时,文件系统有机会执行一些工作 - 对于 xfs,这涉及延迟分配核算和盘区创建。您可以尝试事先预分配整个文件,看看这会如何/是否会改变事情。 (jfs 使用通用 mmap 操作,它不提供页面可写时使用的回调)。

另请注意,一旦脏页缓存页的比例超过 /proc/sys/vm/dirty_ratio,内核将从后台异步写回切换为脏页进程同步写回。

Writes are done straight to the page cache, but the first time you hit each page with a write will cause a minor fault to mark the page as dirty. At this point the filesystem has the chance to perform some work - in the case of xfs, this involves delayed allocation accounting and extent creation. You could try preallocating the entire file beforehand to see how/if this changes things. (jfs uses the generic mmap operations, which does not supply a callback used when a page is made writeable).

Note also that once the proportion of dirty pagecache pages exceeds /proc/sys/vm/dirty_ratio, the kernel will switch from background asynchronous writeback to synchronous writeback of dirty pages by the process that dirtied them.

风和你 2024-11-01 12:14:30

XFS 和 JFS 之间的一个显着区别是 XFS 支持屏障并默认启用它们,但 JFS 根本不支持屏障。因此,当 JFS 在具有回写式缓存的磁盘上运行时,它是不安全的(但速度很快!)。

JFS 在您的测试中具有更好的写入性能可能就是这一点的结果。

One significant difference between XFS and JFS is that XFS supports barriers and enables them by default, but JFS doesn't support barriers at all. Hence JFS is unsafe (but fast!) when running on disks with write-back cache.

JFS having better write performance in your tests might be an effect of this.

怪我鬧 2024-11-01 12:14:30

也许您应该查看每个文件系统的基准测试。 AFAIK 在某些条件下每个 FS 都很快。

http://fsbench.netnation.com/ 是我在 Google 中搜索 xfs jfs 基准测试的第一个命中结果之一。浏览结果似乎表明 xfs 在许多情况下速度更快。

我建议您在目标机器上运行基准测试来亲自找出答案。

一种猜测是,您注意到的加速很可能发生在 jfs 的最佳情况区域。

Perhaps you should look at the benchmarks for each filesystem. Each FS is fast at certain conditions AFAIK.

http://fsbench.netnation.com/ was one of the first hits in my Google for xfs jfs benchmarks. Skimming at the results appears to suggest xfs fares better at speed on many occasions.

I suggest you run the benchmarks on the target machines to find out for yourself.

One guess is, the speedup you noticed could very well be in the best case areas of jfs.

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