gpt4 book ai didi

caching - 'flush to disk' 是什么意思?

转载 作者:行者123 更新时间:2023-12-02 14:38:06 24 4
gpt4 key购买 nike

有人可以解释一下在以下上下文中刷新到磁盘的含义吗?如果我将数据写入文件系统上的日志,这是否意味着我将其放在磁盘上?在什么时候您会/应该将文件刷新到磁盘?

This suggests a design which is very simple: rather than maintain as much as possible in-memory and flush it all out to the filesystem in a panic when we run out of space, we invert that. All data is immediately written to a persistent log on the filesystem without necessarily flushing to disk. In effect this just means that it is transferred into the kernel's pagecache.

(来自 https://kafka.apache.org/documentation.html#design )。

最佳答案

All data is immediately written to a persistent log on the filesystem without necessarily flushing to disk. In effect this just means that it is transferred into the kernel's pagecache.

这意味着 Kafka 通过 write() 系统调用将数据交给内核——此时数据对其他进程可见,但实际上可能会也可能不会反射(reflect)在磁盘上,并且重新启动后仍然存在——但不会强制内核通过 fsync() 调用或类似的调用将其快速写入磁盘(适合当前的操作系统)。如果优化吞吐量并且不需要保证内容可检索,这可能是一个适当的决定:fsync() 及其同类可能是昂贵的调用(尽管通过执行不需要的长时间连续写入)查找时,kafka 最大限度地减少了磁盘 IO 的开销)。

关于caching - 'flush to disk' 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35050661/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com